Exemplo n.º 1
0
    public IGraph Clone()
    {
        Incidence incidence = new Incidence();

        for (int i = 0; i < _arcs.Count; i++)
        {
            incidence.AddArc(_arcs[i]);
        }
        return(incidence);
    }
Exemplo n.º 2
0
    public static Incidence StrToGraph(this string representation)
    {
        var       lines = representation.Split(' ', ',', ';');
        Incidence graph = new Incidence();

        for (int i = 0; i < lines.Length; i += 2)
        {
            graph.AddArc(new Arc(new Node(Convert.ToInt32(lines[i])), new Node(Convert.ToInt32(lines[i + 1]))));
        }
        return(graph);
    }