Skip to content

dfs function on AlgorithmUtils.java doesn't work properly #41

@Welcius

Description

@Welcius

IsEulerian still doesn't work because isConnected fails due an error on the dfs function on AlgorithmUtils.java, seems that it only gets executed once. (tried debugging it by myself but I am not familiar with java and the project itself yet).

The code of the faulty dfs function it's this one:

public static <VertexType extends BaseVertex, EdgeType extends BaseEdge<VertexType>>
void dfs(BaseGraph<VertexType, EdgeType> g,
         int node, ArrayList visit, int parent[]) {
    visit.add(node);
    ArrayList e = getAdjList(g);
    ArrayList neighbors = (ArrayList) e.get(node);
    for (Object neighbor1 : neighbors) {
        int neighbor = (Integer) neighbor1;
        if (parent[neighbor] == -1) {
            parent[neighbor] = node;
            dfs(g, neighbor, visit, parent);
        }
    }
}

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