public static WIntGraphBuilder CreateTree(int count, PropertyConsoleReader cr) { var gb = new WIntGraphBuilder(count, false); for (var i = 1; i < count; i++) { gb.Add(cr.Int0, cr.Int0, cr.Int); } return(gb); }
public static WIntGraphBuilder Create(int count, PropertyConsoleReader cr, int edgeCount, bool isDirected) { var gb = new WIntGraphBuilder(count, isDirected); for (var i = 0; i < edgeCount; i++) { gb.Add(cr.Int0, cr.Int0, cr.Int); } return(gb); }
public static WGraph <int, IntOperator, WGraphNode <int, WEdge <int> >, WEdge <int> > ToWeighted(this SimpleGraph <GraphNode, GraphEdge> graph) { var grrArr = graph.AsArray(); var isDirected = graph.Nodes[0].IsDirected; var gb = new WIntGraphBuilder(graph.Length, isDirected); for (int i = 0; i < grrArr.Length; i++) { foreach (int ch in grrArr[i].Children) { if (isDirected || i <= ch) { gb.Add(i, ch, 1); } } } return(gb.ToGraph()); }