Skip to content

Possible bug in Graph definition #95

Open
@liuzhilide

Description

@liuzhilide
/** Deep copies **/
public Graph(Graph<T> g) {
    type = g.getType();

    // Copy the vertices which also copies the edges
    for (Vertex<T> v : g.getVertices())
        this.allVertices.add(new Vertex<T>(v));

    for (Vertex<T> v : this.getVertices()) {
        for (Edge<T> e : v.getEdges()) {
            this.allEdges.add(e);
        }
    }
}

I don't think it‘s a Deep copies. Although those new Vertices have associated with those Edges, but Edges still associated with old Vertices;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions