Example #1
0
 private void CloneAndAddAllSubgraphs(IGraph root, ISubGraph currentSubgraph,
                                      IDictionary <ISubGraph, ISubGraph> subgraphDictionary)
 {
     foreach (var subgraph in currentSubgraph.GetSubGraphSubGraphs())
     {
         var clonedSubgraph = new SubGraph(subgraphDictionary[currentSubgraph], subgraph.Id);
         clonedSubgraph.SetAttributes(subgraph.GetAttributes());
         clonedSubgraph.SetNodeAttributes(subgraph.GetNodeAttributes());
         clonedSubgraph.SetEdgeAttributes(subgraph.GetEdgeAttributes());
         var addedSubgraph = root.AddSubGraph(clonedSubgraph);
         subgraphDictionary[subgraph] = addedSubgraph;
         CloneAndAddAllSubgraphs(root, subgraph, subgraphDictionary);
     }
 }
Example #2
0
        public ISubGraph CreateSubGraph(
            string id,
            IAttributeDictionary graphAttrs,
            IAttributeDictionary nodeAttrs,
            IAttributeDictionary edgeAttrs)
        {
            var subgraph      = new SubGraph(this, id);
            var addedSubGraph = Root.AddSubGraph(subgraph);

            addedSubGraph.SetAttributes(graphAttrs);
            addedSubGraph.SetNodeAttributes(nodeAttrs);
            addedSubGraph.SetEdgeAttributes(edgeAttrs);
            return(addedSubGraph);
        }