Ejemplo n.º 1
0
        private static void toDot(
            JointGraph g, StreamWriter writer,
            NodeSet nodes = null, NodeSet selected = null)
        {
            IEnumerable <Node> printNodes;

            if (null == nodes)
            {
                printNodes = g.nodes;
            }
            else
            {
                printNodes = nodes;
            }
            writeHeader(writer);
            foreach (Node node in printNodes)
            {
                if (null != selected && selected.Contains(node))
                {
                    writeNode(node, writer, true);  // fill color
                }
                else
                {
                    writeNode(node, writer);
                }
            }
            EdgeDict edges = g.directedEdges;

            foreach (Node node in printNodes)
            {
                writeEdge(node, edges[node], writer);
            }
            writeFooter(writer);
        }
Ejemplo n.º 2
0
        internal void addNode(Node node)
        {
            EdgeDict[] el = new EdgeDict[] {
                this.directedEdges,
                this.unDirectedEdges
            };

            foreach (EdgeDict e in el)
            {
                if (!e.ContainsKey(node))
                {
                    e[node] = new NodeSet();
                }
            }
            return;
        }
Ejemplo n.º 3
0
 private NodeSet traceGraph(Node fromNode, EdgeDict edgeDict,
                            NodeSet visited = null)
 {
     if (null == visited)
     {
         visited = new NodeSet();
     }
     if (!visited.Contains(fromNode))
     {
         visited.Add(fromNode);
         foreach (Node linkedNode in edgeDict[fromNode])
         {
             visited = traceGraph(linkedNode, edgeDict, visited);
         }
     }
     return(visited);
 }
Ejemplo n.º 4
0
        private static void toDot(BoneGraph g, StreamWriter writer)
        {
            IEnumerable <Node> printNodes = g.nodes;

            writeHeader(writer);
            EdgeDict edges = g.directedEdges;

            foreach (Node node in printNodes)
            {
                writeNode(node, edges[node].Item1, writer);
            }
            foreach (Node node in printNodes)
            {
                writeEdge(node, edges[node].Item2, writer);
            }
            writeFooter(writer);
        }
Ejemplo n.º 5
0
 internal JointGraph()
 {
     this.directedEdges   = new EdgeDict();
     this.unDirectedEdges = new EdgeDict();
 }
Ejemplo n.º 6
0
 internal BoneGraph()
 {
     this.directedEdges = new EdgeDict();
 }