Action:
|
Sets the weight for an edge of a graph.
|
|
Filename:
|
kern/kern_scm/graph_scm.cxx
|
|
Syntax:
|
(graph:edge-weight in-graph {edge-name weight} |
|
|
|
{vertex-name1 vertex-name2 weight})
|
|
Arg Types:
|
in-graph
|
graph
|
|
edge-name
|
string
|
|
weight
|
real
|
|
vertex-name1
|
string
|
|
vertex-name2
|
string
|
|
Returns:
|
graph
|
|
|
in-graph specifies a graph.
|
|
|
edge-name specifies the edge by name.
|
|
|
weight specifies the value to be assigned.
|
|
|
vertex-name1 and
vertex-name2 specifies the edge by naming the two bounding vertices.
|
|
Example:
|
; graph:edge-weight
|
|
; Create a simple graph.
|
|
(define g1 (graph "a-b b-c c-e c-d c-f f-g f-h"))
|
|
;; g1
|
|
(graph:edge-weight g1 "a" "b" 3)
|
|
;; #[graph "a-b b-c c-d c-e c-f f-g f-h"]
|
|
(graph:edge-weight g1 "c-e" 5)
|
|
;; #[graph "a-b b-c c-d c-e c-f f-g f-h"]
|
|
(graph:total-weight g1)
|
|
;; 8
|