1 Macros |
|
|
define-adjacency-list |
Form | (define-adjacency-list name algorithms (VTYPE . args) vertex-properties (ETYPE . args) edge-properties directed? bidirectional?) |
Description | Creates specialized adjacency-list graph methods,
and imports them into the current lexical scope. The methods that
will be created (see Graph Methods and the documentation for your
'vertex-list and 'edge-list) with be prefixed with the argument 'name
as opposed to "NAME". |
Parameters | name | graph type name, which is used to
prefix all the graph methods |
algorithms | list of algorithms |
(VTYPE . args) | vertex list constructor |
vertex-properties | list of internal vertex
properties |
(ETYPE . args) | edge list constructor |
edge-properties | list of internal edge
properties |
directed? | #t if directed graph, #f if
undirected |
bidirectional | #t if in-edge methods are
to be created |
Returns | |
Example |
(define test-example
(lambda ()
(define-adjacency-list xyz
(fill-graph! depth-first-search topological-sort)
(vl-vector) (vertex-name vertex-color)
(el-slist) (edge-weight)
#t #f)
(define g1 (make-xyz))
(print g1)
(define v1 (xyz-add-vertex! g1))
(define v2 (xyz-add-vertex! g1))
(define v3 (xyz-add-vertex! g1))
(define e1 (xyz-add-edge! g1 v1 v2))
(define e2 (xyz-add-edge! g1 v1 v3))
(define e3 (xyz-add-edge! g1 v2 v3))
(print (xyz-vertices g1))
(stream-for-each print (xyz-vertices* g1))
(print (xyz-edge g1 v1 v2)) ) )
|
See also | | |
Graph Methods | graph-methods |
|
2 Graph Methods |
|
|
make-NAME |
Form | (make-NAME) |
Description | Construct the specialized adjacency list graph. |
Returns | adjacency-list-graph |
|
NAME-add-edge! |
Form | (NAME-add-edge! graph u-vertex_descriptor v-vertex_descriptor) |
Description | Adds an edge(u,v) to graph |
Returns | edge_descriptor |
|
NAME-remove-edge! |
Form | (NAME-remove-edge! graph edge_descriptor) |
Description | Removes an edge described by its descriptor |
|
NAME-remove-edge2! |
Form | (NAME-remove-edge2! graph source-vertex_descriptor
target-vertex_descriptor) |
Description | Removes the edge(source,target) |
Returns | (if 'found-and-removed #t #f) |
|
NAME-out-edges |
Form | (NAME-out-edges graph u-vertex_descriptor) |
Description | Gets a list of out-edges for vertex u. |
Returns | (list out-edge_descriptor ...) |
|
NAME-out-edges* |
Form | (NAME-out-edges* graph u-vertex_descriptor) |
Description | Gets a stream of out-edges for vertex u. |
Returns | (stream out-edge_descriptor ...) |
|
NAME-in-edges |
Form | (NAME-in-edges graph u-vertex_descriptor) |
Description | Gets a list of in-edges for vertex u. Defined only if bidirectional? is true. The ordinary semantics of source and target for directed? graphs are maintained: (NAME-target graph in-edge_descriptor) will always return u. |
Returns | (list in-edge_descriptor ...) |
|
NAME-in-edges* |
Form | (NAME-in-edges* graph u-vertex_descriptor) |
Description | Gets a stream of in-edges for vertex u. Defined only if bidirectional? is true. The ordinary semantics of source and target for directed? graphs are maintained: (NAME-target graph in-edge_descriptor) will always return u. |
Returns | (stream in-edge_descriptor ...) |
|
NAME-neighbours |
Form | (NAME-neighbours graph u-vertex_descriptor) |
Description | Gets a list of neighbours for vertex u. Defined only if bidirectional? is true or if directed? is false. The ordinary semantics of source and target for directed? graphs are maintained: (NAME-target graph neighbour-edge_descriptor) will always return u. |
Returns | (list (cons neighbour-vertex_descriptor neighbour-edge_descriptor) ...) |
|
NAME-neighbours* |
Form | (NAME-neighbours* graph u-vertex_descriptor) |
Description | Gets a stream of neighbours for vertex u. Defined only if bidirectional? is true or if directed? is false. The ordinary semantics of source and target for directed? graphs are maintained: (NAME-target graph neighbour-edge_descriptor) will always return u. |
Returns | (stream (cons neighbour-vertex_descriptor neighbour-edge_descriptor) ...) |
|
NAME-out-degree |
Form | (NAME-out-degree graph vertex_descriptor) |
Description | Gets number of out-edges for vertex. |
Returns | number-of-out-edges-integer |
|
NAME-in-degree |
Form | (NAME-in-degree graph vertex_descriptor) |
Description | Gets number of in-edges for vertex. Defined only if bidirectional? is true. |
Returns | number-of-in-edges-integer |
|