Skip to content

Fix example in docs.rs example #804

@RaoulLuque

Description

@RaoulLuque

The example on docs.rs states that the output of the last println! is supposed to be:

graph {
    0 [label="\"0\""]
    1 [label="\"0\""]
    2 [label="\"0\""]
    3 [label="\"0\""]
    1 -- 2
    3 -- 4
    2 -- 3
}

However, it actually is:

graph {
    0 [ label = "0" ]
    1 [ label = "0" ]
    2 [ label = "0" ]
    3 [ label = "0" ]
    4 [ label = "0" ]
    1 -- 2 [ ]
    3 -- 4 [ ]
    2 -- 3 [ ]
}

This highlights pretty well, one of the reasons why I find the example confusing. Using from_edges in the beginning starting with 1 as the lowest index creates a 0 node which does nothing. Hence I would suggest changing the example slightly and shift the indices of the nodes in the example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions