turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- How to represent a graph?

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

06-14-2015 04:35 PM

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')