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); }
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; }
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); }
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); }
internal JointGraph() { this.directedEdges = new EdgeDict(); this.unDirectedEdges = new EdgeDict(); }
internal BoneGraph() { this.directedEdges = new EdgeDict(); }