graph:subset
 List of: Scheme Extensions Subjects: Graph Theory Contents: Kernel
Action: Creates a subgraph from a given graph using either two integers or a law.

Filename: kern/kern_scm/graph_scm.cxx

Syntax: (graph:subset in-graph {subset-law |

low-bounds up-bounds})

Arg Types: in-graph graph

subset-law law

low-bounds integer

up-bounds integer

Returns: graph

Description: Given an ordered graph, a subgraph may be formed using one of two techniques. One method takes in two integers and the other takes a law pointer.

in-graph specifies a graph.

subset-law specifies a law. This extension with subset-law returns the set of all vertices such that their order evaluates as true along with the all edges that have both of their adjacent vertices evaluating as true orders.

This extension with low-bounds and up-bounds returns a subgraph in one of two ways.

1. If low-bounds<up-bounds, then the set of all vertices with orders between low-bounds and up-bounds is returned along with all edges that have both of their adjacent vertices in this set.

2. If up-bounds<low-bounds, then the set of all vertices with orders not between low-bounds and up-bounds is returned along with all edges that have both of their adjacent vertices in this set.

Example: ; graph:subset

; 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

(define g2 (graph:subset g1 1 3))

;; g2

(define g3 (graph:subset g1 "x>2"))

;; g3

(define law1 (law "(x>2)or(x=0)"))

;; law1

(define g4 (graph:subset g1 law1))

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