public void OnAfterDeserialize() { nodeIdCollisions = new bool[nodes.Count]; digraph = new WeightedDiGraph <N, E>(nodes.Count); // first pass, restore nodes for (int i = 0; i < nodes.Count; i++) { if (nodes[i].id != null) { if (!Contains(nodes[i].id)) { AddNode(nodes[i].id, nodes[i].data); nodeIdCollisions[i] = false; } else { nodeIdCollisions[i] = true; } } } // second pass, restore edges for (int i = 0; i < edges.Count; i++) { try { SetEdge(edges[i].fromId, edges[i].toId, edges[i].weight, (EdgeDirectionality)edges[i].directionality); } catch (Exception e) when(e is ArgumentNullException || e is ArgumentException) { // ignore the edge } } }
public SWeightedDiGraph(int capacity) { digraph = new WeightedDiGraph <N, E>(capacity); }
public SWeightedDiGraph() { digraph = new WeightedDiGraph <N, E>(); }