SchemeExt:Graph:order-from

From DocR21

Jump to: navigation, search

Contents

Action

Sets the order of a graph starting at 0 for the specified vertex.

Filename

scm/scmext/kern/graph_scm.cpp

APIs

None

Syntax

(graph:order-from in-graph in-vertex)

Argument Types

Argument Scheme Data Type
in-graph graph
in-vertex string | entity

Returns

integer

Description

When ordering the graph starting at 0 for the specified in-vertex, each subsequent vertex receives a number based on how far away it is (for example, how many edges) from the starting vertex. The integer returned is the maximum number of "hops" that one or more vertices are from the starting vertex.

Arguments

  • in-graph specifies a graph.
  • in-vertex could be either the designation string for a vertex of the graph or a model entity associated with the graph vertex.

Example

; graph:order-from
; Create a simple graph.
(define g1 (graph "a-b b-c c-e c-d c-f f-g f-h"))
;; g1
(graph:order-from g1 "a")
;; 4
(graph:show-order g1)
;; ("a 0" "b 1" "c 2" "e 3" "d 3" "f 3" "g 4" "h 4")
Personal tools
Live