dcsex.containers.graph

Basic Graph container

Contents

  1. Functions
    1. Edge:__init(cost)
    2. Edge:cost()
    3. Node:found(node)
    4. Graph:exists(x)
    5. Graph:neighbors(x)
    6. Graph:adjacent(x, y)
    7. Graph:add_node(x)
    8. Graph:remove_node(x)
    9. Graph:add_edge(x, y, edge)
    10. Graph:remove_edge(x, y)

Functions

Edge:__init(cost)

Parameters

cost

Edge:cost()

Needed in weighted graph searches.

Returns

  • number

Node:found(node)

Parameters

node

Returns

  • boolean

Graph:exists(x)

Parameters

x

Returns

  • boolean

Graph:neighbors(x)

Parameters

x

Returns

  • list

Graph:adjacent(x, y)

Parameters

x
y

Returns

  • boolean

Graph:add_node(x)

Parameters

x

Graph:remove_node(x)

Parameters

x

Graph:add_edge(x, y, edge)

will overwrite any edge previously associated with a x-y pair

Parameters

x
y
edge

Graph:remove_edge(x, y)

Parameters

x
y