Skip to content

Implement Graph/Vertex class #90

@HuangJi

Description

@HuangJi

自製 Graph.hVertex.h

Graph 的 attributes/methods

V: vector<vertex>

int add_vertex(vertex)
int remove_vertex(name)
void get_vertices_list()

int add_vertex(vertex)

將一個 vertex 加入 graph,之後就會顯示在 graph.V 裡面,graph.get_vertices_list() 也能列出來,成功回傳 1 ,失敗回傳 0

int remove_vertex(name)

傳入 vertexname 來刪除 vertex,如果成功回傳 1, 失敗回傳 0

void get_vertices_list()

將這個 graph 的所有 vertices name都列出來,中間用空白隔開,沒有就顯示 empty ,example:

3 5 6 a b c

or

empty

Vertex 的 attributes/methods

name: string
discover: int
finish: int
parent: vertex pointer
color: string
adjacency: vector<vertex>

void connect_vertex(vertex)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions