Hello everyone,
I try implement a graph theoretical algorithm in a DS2 datastep. I have problem with finding an elegant way to represent a graph. It should be such that I can find a vertice directly without going sequentilly throug all vertices, and same with edges.
I have tried doing this with three hash-objects: one that are indexed by the vertice from which arrows goes from, one indexed by vertices that arrows goes to, and one with both. This is clumpsy I think, since same information is saved several time. But neccessary since I need indexes on all three (vertices with arrows from, vertices with arrow to and the arrows indexed by both from- and end vertice). Has anyone a better suggestion for representing a graph?
declare package hash edges([from_ to_],[from_ to_ capacity used],8,'','no','','','no')
tos([to_],[from_ to_ capacity used],8,'','no','','','multidata')
froms([from_],[from_ to_ capacity used],8,'','no','','','multidata')