public static Graphs.Graph GraphFromGraph6(string graph6) { var w = GetEdgeWeights(graph6); var h = new Choosability.Graph(w); var g = new Graphs.Graph(h, h.GetSpringsLayout(12), false); g.Name = graph6; return(g); }
public static Graphs.Graph GraphFromEdgeWeightString(string s) { var isDirected = s.Contains("-1"); var parts = s.Split(' '); var edgeWeights = parts.Where(p => !p.StartsWith("[")).Select(x => int.Parse(x)).ToList(); List <int> vertexWeights = null; var vwp = parts.FirstOrDefault(p => p.StartsWith("[")); if (vwp != null) { vertexWeights = vwp.Trim('[').Trim(']').Split(',').Select(x => int.Parse(x)).ToList(); } var h = new Choosability.Graph(edgeWeights, vertexWeights); return(new Graphs.Graph(h, h.GetSpringsLayout(12), isDirected)); }