Closed (won't fix)
Project:
Graphviz
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
14 Dec 2012 at 14:22 UTC
Updated:
6 Jan 2013 at 17:27 UTC
Jump to comment: Most recent file
It is currently not possible to add subgraphs.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | Graph API | Site-Install.png | 67.1 KB | clemens.tolboom |
| #9 | graphapi-graphviz_subgraphs-1866760-9.patch | 11.81 KB | s.daniel |
| #6 | b9aff8189dfbcbbb4e6a49cc7f7ec032.out_.png | 50.83 KB | s.daniel |
| #6 | 0ac2b09fcc0ad17170dbcf68dfd0ea16.out_.png | 43.9 KB | s.daniel |
| #6 | graphapi-subgraph_simple-1866760-6.patch | 920 bytes | s.daniel |
Comments
Comment #1
s.daniel commentedExample of a subgraph in graphviz:
dot code
result

Source:
http://www.graphviz.org/content/cluster
Comment #2
clemens.tolboomThat dot file is the one I always refer to myself :)
One problem with graphviz implementation is one cannot link to a subgraph like
a3 ->subgraph cluster_0A problem for graph_phyz is it cannot know the contents of a subgraph like
a3 -> b2graph.inc and Graph API data structure lack the ability to register a link to a node in a subgraph.
Maybe we can introduce a namespace construct like
sub1:a1to trigger code to dig deeper (recursive) into the graph structure.As each node has it's internal structure free at will it can contain sub graphs no problem.
Puzzle is the inter graph: do we need absolute path or relative?
leads to structure
Hope this helps a little.
We should read some docs too. Maybe http://en.wikipedia.org/wiki/Graph_theory has some useful ones.
Comment #3
clemens.tolboomI just realize the above is not correct. Each 'node' must have a unique ID. Indicating it is a part of a subgraph is crap. a subgraph is just a grouping of unique IDs
@s.Daniel can you try do describe how one or more views can provide for your subgraphs?
See also #1396538: Should we merge multiple views outputs into 1 graph? or maybe views grouping could help?
Comment #4
clemens.tolboomProblem with graphviz is linking to a subgraph. Say node A is a subgraph then it is not available for linking. But node A is a unique ID from Graph API perspective.
IE nodes A, B, C, D, E, F form a network like
disallow for links like
d -> cluster_a. But our data-structure is IEThe datastructure looks ok to me. We now can express node 'A' is a subgraph containing nodes 'B' and 'C'.
Next we need some primitives/functions to manipulate subgraphs.
Note ours data-structure deflates the parent-child tree into a one level deep structure.
The renderer ie graph_phyz or graphviz need to do a topological sort to create their tree nature back.
@s.Daniel What do you think?
Comment #5
clemens.tolboomI did a first attempt. The graph from #1 should be possible.
But we need a solution for nested subgraphs. No a big deal but it needs some more time.
See
@s.Daniel please test the current state and please help with the views question from #3
Comment #6
s.daniel commentedGood progress.
I'm not sure how the question is ment. If you are asking for my use case: I have a node with several taxonomy vocabularies as fields available. One of these fields can contain hirarchial terms. e.G.
time > year > month > week > ...In the node only the
yearis selected but in the display I think consider printing the whole tree as a subgraph with only the year linked to the main node.Here is the dot output from
admin/config/system/graphapi/demo/graphvizand here is the output run through

graphviz_filter_filterproc:Regarding the data structure, topological sort etc. I am not sure yet. Can't we do something simple like:
The result looks good so far but I guess you are thinking of more advanced use cases which I don't consider yet.

Links from/to subgraphs
There seems to bee a hacky solution for this in graphviz. I implemented this however I'm not sure if this is the way to go because of the subthree comment and beause it needs the settings:
$dot[] = 'graph [fontsize=10 fontname="Verdana" compound=true];';to work. Here is a simple patch. I've created a more advanced one as well but I mixed up changes so it would require cleanup which I'll do if you say that it's the way to go. I'll store my futur changes in a sandbox.Here is the result of the code in the sandbox:

Comment #7
s.daniel commented@See: Here is the feature request for graphviz http://www.graphviz.org/mantisbt/view.php?id=1968
@Note (for myselfe): Currently I get the error
on every first load of a new graph rendered by graphviz which might be related to my latest changes.
Comment #8
clemens.tolboomNice finding: dot lingo : compound = TRUE
That brings us to the settings forms. Through views each graph has overall (graph) settings and node or link settings. So this compound setting should probably set on the graph and maybe node level.
You patch is too big. You prob downloaded a tarball?
You should add a remote to your sandbox I guess
git add remoteto Graph API.Oeps
Changing a var name ... why?
I'm not sure my dev env works with it :(
I prob should try it now there is a D7 version.
Whitespace
It should receive the $settings too.
The settings should contain the global graph and node and link settings.
I should have fixed this earliers. Sorry.
Is this in line with latest version?!?
Comment #9
s.daniel commentedThank you for your feedback.
You are probably right about the tarball. Must have mixxed something up here.
In first place I wanted the sandbox to be a place show what I'm working on atm. The big patch was not ment to be committed right away. However graphapi is allready added as a remote and I was able to pull your latest commits.
When I read through the code it was easier for me to get with the same variable name used across the different submodules. I can change that back if you like.
I use http://drupal.org/project/drupalpro for development where setting up graphviz was very easy. Realy love working with it and it's good to try out stuff you don't want to mess up your envoironment with. Just
drush qc --domain=graphviz.devcd ~/websites/graphviz.dev/sites/all/modulesgit clone ...Did you check the small patch? http://drupal.org/files/graphapi-subgraph_simple-1866760-6.patch
Think so
I'll digg into the settings and create a better looking patch in a day or two. Attached is the current diff - again not really ready to be committed. It includes all my changes including Remove demo code from graphapi.module.
I should probably create a branch for each of the changes and merge them all into one feature branch to make it easier in the future to split up patches :/
Comment #10
s.daniel commentedHmm graphviz has an incredible ammount of possible settings. Different rendering engines, output formats, attributes etc. And all of that in special combinations. Here is the attributes documentation e.g.: http://www.graphviz.org/content/attrs
I wonder now how much of that configuration we would want as a submodule of graph api?
Comment #11
clemens.tolboomIf you think graphviz_filter is the drupal only implementation we should move over all code over to that project.
But for now we can express each render engine (dot, neato, ... ) as a separate _graphapi_format.
Comment #12
clemens.tolboomI move this issue to Graphviz project.
See it's Graph Phyz counterpart #1881376: Should we add subgraphs.
Comment #13
clemens.tolboomGraphviz now has settings in progress.
See /admin/config/system/graphapi/engines/graphviz
I think we should not apply the patch from this issue.
Let's create a few new issues from this one ok?
- graph [fontsize=10 fontname="Verdana" compound=true] can be done through #1881430: Add useful attributes to the project.
The settings from mentioned issue are not yet applied through the theme function.
Comment #14
clemens.tolboom#7 is done by #1881548: Convert PHP variables to the DOT text format
#10 is covered by #1881430: Add useful attributes to the project.
Original feature is now in #1881552: Add nested subgraphs
So I close this one as this was about sub graph support we now have in small.
Next time we must try to keep the issue on topic a little more. My bad too ;-)
Comment #15
clemens.tolboomPlease open new issues for items I've missed :-)