graph:shortest-path
List of: Scheme Extensions
Subjects: Graph Theory
Contents: Kernel

Action: Returns the shortest path graph that includes the two specified graph vertices.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:shortest-path in-graph in-vertex1 in-vertex2)

Arg Types: in-graph graph

in-vertex1 string | entity

in-vertex2 string | entity

Returns: graph

Description: This extension can be used to trim away branches off of a cyclic graph.


in-graph specifies a graph.


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


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

Example: ; graph:shortest-path

; Create a simple example

(define g1 (graph "me-you you-us us-them


them-they me-they


FIDO-SPOT SPOT-KING SPOT-PETEY"))

;; g1

; CAREFUL: The order of the graph output may

; not be the same each time.

(define g2 (graph:shortest-path g1 "me" "us"))

;; g2

(define g3 (graph:shortest-path g1 "me" "FIDO"))

;; g3

(define g4 (graph:shortest-path g1 "PETEY" "FIDO"))

;; g4
PDF/KERN/13SCF.PDF
HTM/DATA/KERN/KERN/13SCF/0061.HTM