Skip to content

Can you consider change the code of "graph_adjacency-matrix.py" a little? #8

Description

@ChenJianHong2025

Can you consider change the position of
self.edges.append([0] * (len(self.edges)+1))
after this line
self.vertices[vertex.name] = vertex

Since
self.edges.append([0] * (len(self.edges)+1))
is for initializing the matrix to zeros. Especially, adding the first edge, it is not easy to understand. Because when this line changes position it follows the initializing, appending new initialized edges, fill the weight number logic. That will be more easy for comprehension.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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