Post Reply 
Working with GraphML under Flare
06-03-2009, 12:25 AM
Post: #1
Working with GraphML under Flare
Hi together,

I am working on a project with nested hierarchically structured graphs, i.e. a node of a graph shall be the container of another graph. When zooming into a node the nested graph shall appear within the zoomed-in node.
As I want to import and export the graphs I need a proper DataStructure, e.g. XML. I informed myself a bit about GraphML and decided to use data like this

Code:
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
  <graph id="G" edgedefault="undirected">
    <node id="n0"/>
    <node id="n1"/>
    <node id="n2"/>
    <node id="n3"/>
    <node id="n4"/>
    <node id="n5">
        <graph id="n5:" edgedefault="undirected">
          <node id="n5::n0"/>
          <node id="n5::n1"/>
          <node id="n5::n2"/>
          <edge id="e0" source="n5::n0" target="n5::n2"/>
          <edge id="e1" source="n5::n1" target="n5::n2"/>
        </graph>
    </node>
    <node id="n6">
        <graph id="n6:" edgedefault="undirected">
          <node id="n6::n0">
              <graph id="n6::n0:" edgedefault="undirected">
                <node id="n6::n0::n0"/>
               </graph>
          </node>
          <node id="n6::n1"/>
          <node id="n6::n2"/>
          <edge id="e10" source="n6::n1" target="n6::n0::n0"/>
          <edge id="e11" source="n6::n1" target="n6::n2"/>
        </graph>
    </node>
    <edge id="e2" source="n5::n2" target="n0"/>
    <edge id="e3" source="n0" target="n2"/>
    <edge id="e4" source="n0" target="n1"/>
    <edge id="e5" source="n1" target="n3"/>
    <edge id="e6" source="n3" target="n2"/>
    <edge id="e7" source="n2" target="n4"/>
    <edge id="e8" source="n3" target="n6::n1"/>
    <edge id="e9" source="n6::n1" target="n4"/>
  </graph>
</graphml>

This is the example of the GraphML primer for nested graphs. I've already written a small method for the export of a visualization, but I'm not able to realize the nested structure. What I did was creating a new DataSet out of existing visualisation data by traversing each node of the visualization and using GraphMLConverter.write function.
Unfortunately I have no idea how to realize the "nesting". I think I'll have problems on this issue with the import as well, but for now I would be very happy if anyone had a proposal of how to solve the export issue.
The second question is, if it is actually possible to "nest" a graph into a NodeSprite in flare. A small "yes" or "no" would be enough for me on this issue. Thx in advance
Find all posts by this user
Quote this message in a reply
06-03-2009, 04:48 PM (This post was last modified: 06-03-2009 04:57 PM by 34all.)
Post: #2
RE: Working with GraphML under Flare
Hi Korbman

just briefly on the second question. Since the data property as an associative array can hold anything why not a nested subgraph, something like

ns.data["subgraph"] = subGraphData;

where subGraphData is the Data object of the subgraph.

So while I can't see any problem around storing of the nested graph everything else you would have to implement yourself I guess (and that is not more than a guess)

Hope you keep us updated on how this interesting project is going and hope some others have more help to offer.

cheers

martin
Find all posts by this user
Quote this message in a reply
15-03-2009, 10:35 PM
Post: #3
RE: Working with GraphML under Flare
Thanks Martin for your reply.

I found a solution for my first question. In order to add the subgraph as a nested graph into my visualization i had to find a way to read out the subgraph information from the GraphML into my Visualization data. For this I changed GraphMLConverter-Class in parse-Method like this

Code:
for each (var node:XML in graphml.graph.node) {

                id = node.@[ID].toString();
                lookup[id] = (n = parseData(node, nodeSchema));
                
        ////////////////////////////////////////////////////////////////inserted solution/////////////////////////////////////////////
                    for each (var graph:XML in node.children()[0])
                    {
                    n["childGraph"] = parse(XML("<graphml>"+graph+"</graphml>"),schema);
                    }
                    
        /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                nodes.push(n);
            }

Note that I have changed the for-loop a bit (from graphml..node to graphml.graph.node). Otherwise the nested graphs would have been inserted to my main visualization as a separate Visualization as well. Note that you have to change the for-loop at the edges like this as well.

I then created a field "childNode" to the object n which I appended the nested DataSet returned by parse...

Hope this makes sense to you.

This solution seems to be right for me, but no garantee anyone could use it for his/her project. It seems pretty easy, but took me some time to realize how to do it.
Find all posts by this user
Quote this message in a reply
25-03-2010, 08:42 AM
Post: #4
RE: Working with GraphML under Flare
Thanks for sharing this post. This is a very helpful and informative material. Good post and keep it up. Websites are always helpful in one way or the other, that’s cool stuff, anyways, a good way to get started to renovate your dreams into the world of reality.i like it This is the example of the GraphML primer for nested graphs. I've already written a small method for the export of a visualization, but I'm not able to realize the nested structure. What I did was creating a new DataSet out of existing visualisation data by traversing each node of the visualization and using GraphMLConverter.write function.
Unfortunately I have no idea how to realize the "nesting". I think I'll have problems on this issue with the import as well, but for now I would be very happy if anyone had a proposal of how to solve the export issue.
The second question is, if it is actually possible to "nest" a graph into a NodeSprite in flare. A small "yes" or "no" would be enough for me on this issue. Thx in advance

ccna voice and ccna wireless preparation.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: