Closed (duplicate)
Project:
Graphviz Filter
Version:
6.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
21 Jan 2008 at 00:47 UTC
Updated:
10 Mar 2010 at 04:56 UTC
Jump to comment: Most recent file
Comments
Comment #1
infojunkieRight now the module acts as a filter for nodes. In order to display any of the graphs you have in mind, you can use the following recipe:
1. Write a PHP function that generates a DOT script dynamically from the data you want to display, like the user relationships. The DOT syntax is pretty simple and you should be able to get meaningful output within an hour.
2. Create an input format made up of filters "PHP evaluator" followed by "Graphviz (DOT) syntax".
3. Create a page or story, select the input format that you just created, and call the function that you wrote. Upon submission, the node will render the Graphviz script. Of course, you can also write that function inside the page directly.
3a. Alternatively, you can write a module that exposes a menu item to render your graph. In the callback that implements the menu item, you would call the Drupal function check_markup() with the name of the Graphviz input format and the DOT script that you generated. Upon return you'd get the HTML of the graph which you can embed in your own HTML.
Comment #2
drupalgirl commentedSounds interesting. I think once I get acclimated to the DOT syntax it would surely be worth the pursuit. Creating a module might be an even better route. This would probably take some time on my part being it would be a first attempt at creating a module. I'm interested in seeing what other Drupalers think about this feature functionality. I welcome any other feedback and even coding examples. Thanks.
Drupalgirl
Comment #3
infojunkieI'm closing this until anyone has anything more to add.
Comment #4
naught101 commentedI'm interested in doing this for nodereferences, since I can't find anything elsewhere. @infojunkie, would you be interested in having this as a sub-module, or would you prefer it as separate project?
Two methods would be good:
Node-centric
- Take one node, and find all it's node references (and backreferences), and then pump all that data into a single page, with custom output.
- Find reference relationships between found nodes as well.
- Ideally, it should be possible to do this to an arbitrary level (find all referenced nodes' references' references'...) set by the user.
Taxonomy Limited
Same as above, but limit to only nodes in a single taxonomy term.
Obviously, the node-specific version could be extended to users.
This might work as a custom view, not sure. Or maybe it should create custom pages? It might also be useful to make an auto-created cck field that could be displayed on the node/term page? This last option might be good because it could also be used on a custom content type, and reference an arbitrary node (Say, create node "Company" and then create a second node called "Company's links")
Feedback before I start would be great.
Comment #5
naught101 commentedComment #6
infojunkieThis would live in submodules. You can check existing submodules for workflow, CCK, and taxonomy within the Graphviz Filter module.
If you want to select the nodes for which you'd like to generate a graph, you can consider Views Bulk Operations (http://drupal.org/project/views_bulk_operations): create an action "Graph node relationships" which would generate the actual graph, then let the user select the desired nodes and invoke this action through VBO.
Comment #7
naught101 commented@infojunkie: you mean VBO as a method of selecting an arbitrary set of nodes? Not quite sure what you mean/how this would work. Seems like automatically selecting nodes based on their attributes (references, taxonomy, etc) would be easier and make more sense...
Comment #8
naught101 commentedfor the node/user centric approach, I think it might be easiest to just have a custom recursive function that creates an array of network data, I don't think this can be done with views, because it doesn't seem to have any kind of recursion.
Comment #9
infojunkieI must have misunderstood the part about selecting nodes: my apologies. In any case, let me know if you need any help with the development.
Concerning the original question of whether to package these new graphs as submodules of Graphviz Filter or as a new module altogether, the choice it this: are you ready to maintain these modules? I am willing to maintain them myself as sub-modules, once you attach them here for review.
Comment #10
naught101 commentedOk, this is well on it's way. I've got the recursive link finding working, and I can print to .dot format. I still have to work out the best way to implement it - as a custom field, or a custom node type (easy).
I've hit a bit of a stumbling block though - I can't get any output of angle brackets to print - they get converted automatically to
<>by drupal. I can't figure out why (It's not input formats..). infojunkie, how have you got around this?Comment #11
infojunkieAbout the angle brackets, where do they get converted? I tried to replace curved brackets with angle brackets in the CCK Schema node labels, and they were sent as-is (unconverted) to the DOT processor. However, in order for them to show on the graph, they need to be escaped, as per this doc: http://www.graphviz.org/doc/info/shapes.html (search for "angle brackets").
Comment #12
naught101 commented#725378: Inserting angle brackets in node body results in html entity is what I mean. I can't have directional lines (like "nodeA -> nodeB;" ). I'll just stick to non-directional lines until I can see why that's happening.
I'm going to start trying to implement this as a custom field field first, to see if I can avoid the problem all together.
Comment #13
infojunkieI highly doubt that this is a Drupal bug. You might be writing in a node type that uses a Filtered HTML input format, and make sure that you enclose the graphviz script in a
[graphviz]...[/graphviz]tags.If you're planning to write a module for your graph, then you don't even need to create a node. Check out the taxonomy_graph.module in Graphviz Filter to see how it's done.
Comment #14
naught101 commentedNo, it's not filtering. even with a computed field (which doesn't use input formats at all), I can't get an angle bracket to print. I get errors like;
which roughly translates as:
There's no space between the "-" and the ">"...
Comment #15
infojunkieCan you attach the dot file here please?
Comment #16
naught101 commentedComment #17
naught101 commentedWhoops, this issue is getting a bit convoluted..
Comment #18
infojunkieYou need to say
digraph Ginstead ofgraph G.Comment #19
naught101 commentedGAH!! oh, for eyes that notice fine details in documentation... Sorry about all that..
ok, I've now got this working:
start with one nid and an arbitrary recursion depth
- find all nodereference and nodereferrer field names,
- find all nodereferences and nodereferrers from the given nid, add them to an array (including node id, field name, field type (reference or referrer), and referenced node)
- save an array of all nodes checked, including their Title and content type
- pump both of those arrays into a function that outputs dot format (including labels for edges, URL links, and styling based on content type).
At the moment, I've got a custom computed field that runs all that on a given nid (either from a nodereference field, or the node itself).
It works pretty well, but I think the code is pretty messy, and I'm still not sure what the most user freindly way to package this is: single custom field (limited to targetting the node it's on), or a group of standard fields (node references and options), or a custom node type that throws it all together...
Comment #20
infojunkieTo start with, I suggest a very simple
hook_menuwith a MENU_CALLBACK URL likenode/%node/graphthat graphs the node and its relationships. To graph all nodes, perhaps a URLnode/graph.Comment #21
naught101 commentedok, here's the first draft, with your suggestion implemented. All nodes now have a /graph tab, which displays a node-reference map using both nodereferences and node_refererrers.
This is VERY MUCH A DRAFT. The code is messy, and will probably still need a review after I clean it up. There are a lot of functions that I wish to implement that aren't implemented yet (like the ability to select rendering engine and options and stuff).
Feedback on the general direction this is going would be very much appreciated.
Comment #22
deltab commentedThanks for this great module, and could you check on " $output .= "\t$nid [ shape = \"$shape\" label = \"". $data['title'] . "\" URL = \"/drupal6/node/". $nid."\" ];\n";"
all node label links lead to /drupal6/ instead of /mysite/
also, assuming I am using Node Relationships, along with Node Reference, how easy or difficult will it be to show references pointing to this node, as well as references pointing from this node?
Comment #23
naught101 commentedRight, like I said, needs a clean up. I'm not sure how to create proper URLs from nodes yet, but you could try replacing
It currently does include the noreferreres, but replaces them with the nodereference from the referring node, and then removes duplicates. Look for the bit with array_unique() in it.
I'll try to get a more polished version up, maybe tomorrow. I've been working on getting a CCK field working, and I'm nearly there.
Comment #24
deltab commented@naught101 I am not a coder, but can do everything with testing and usability. I am familiar with most Drupal concepts. So let me know how I can assist in making this a good thing?
Please put up a polished version, and I will deploy it very quickly. Ideally, one would like to see some Graphviz styling options, either as a configuration .inc file or a web UI. And many other ideas.
Care to setup some test cases for me?
Comment #25
infojunkieThanks everyone for your efforts. You might want to coordinate with dman who's working on another schema but is also looking at integrating styling options.
Comment #26
naught101 commentedVersion 0.3, or something. This one allows you to completely customise the graph styling, but there's no verification yet. Maybe this afternoon...
Comment #27
deltab commentedWorks beautifully for me, some UI adjustments and it will be near perfect.
I should like to see:
(a) the image above the form
(b) a global settings tool (admin/settings/graphviz_noderef) for most commands
(c) just the graphviz command and recursion depth in a form below the image
(d) an option to link the imagemap to either node/# or node/#/graph in the global settings so that one can just navigate the graph
(e) some type of integration with node relations so that the graph can be completed (edges incoming as well as outgoing)
perhaps too much to ask, but possible to colour the graph depending on noderelation? like color 1 cck1 -> cck2, color 2 cck1 -> cck 3...
What do you mean by verification?
Comment #28
deltab commented@infojunkie so I have that set of patches running on a different server, nothing much to report as yet, except, a question, When Graphs get Too Large, what type of a summarization technique will be applied?
@naught101, I do realise some of the features I am requesting are really the base (or whatever coders call it) module, but would you agree there should be a UI where I can set the Graph Styling features?
I have some experience with Graphs and the Semantic Web, so it will be good if you all setup some tests for me where we can look at information representation and stuff, I can contribute the best in usability, knowledge usability and Graph aspects should you want to use my skills.
Comment #29
naught101 commented@infojunkie: At the moment, I'm thinking that it might make sense for me to release this as a separate module, so that I can get some decent issue tracking going on without filling up the graphviz_filter issue queue. Also, having CVS access would be very useful for me at this point. Do you agree? Once the module is stable, and/or once I re-code it to work with what ever dman comes up with, it could be merged back into the main module, if it makes sense at that point.
@deltab
a) at the moment, this form is mostly just a testing interface - I'm adding options as I code ways of dealing with them. Personally, I prefer the image below, but maybe that could be a setting for (b)
b) admin/settings/graphviz_noderef: ok, not much would go here yet, that I can see, except maybe default settings? did you have any specific settings in mind?
(c) Don't really understand. What/how/why? Recursion depth is already in the form. Do you mean the "dot -o outfile infiles" bit? cause this is handled by the main module. if you mean the actual dot file, just uncomment the line
// $output = "<pre>$dot</pre>" . $output ;infunction graphviz_noderef_render(d) an option for imagemap links: good idea, will do.
(e) This is already implemented, but with nodereferrer instead of noderelationships. For example, if you have nodeA->references->nodeB, and you have a nodereferrer field on nodeB that picks up that reference, then the nodeB->referrer->nodeA is automatically converted to nodeA->references->nodeB, with the corresponding reference field name. If you want it with noderelationships too, I can try, but it might take a while, since I'll have to figure out how they work.
What styling features do you want in the UI? Do you want to be able to style nodes/edges on a per-node/edge basis? This would be very complex, but I want to implement styling on a per (drupal) node-type and per reference field (edge basis).
Comment #30
deltab commentedhi nought101, (c) I only meant, if the option to set recursion depth and command are below the image, and the rest goes in admin/setting/graphviz, so in (b) go all the other options, and the user, while browsing the graph can make it bigger or smaller, or view it using dot or neato and so on...
I very much would like to see imagemap links.
I just want a per node-type and per reference field (edge basis).
Many thanks.
Comment #31
infojunkie@naught101: I agree it would be better to release this as a separate module. I don't want to hold you up. Feel free to close this issue when the new module's in place.
Comment #32
naught101 commentedok, module created. http://drupal.org/project/graphviz_noderef
Note, that this feature request was originally for User references as well as node, and I am happy to include that in the new module as well, I just haven't yet (patches welcome).
@deltab, this issue is now defunct, please open these issues on the new module, as separate issues. I'll start adding them now.