[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Need igraph to generate foam networks
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] Need igraph to generate foam networks |
Date: |
Fri, 22 Feb 2013 18:04:21 +0100 |
Hi,
> a) Can I constrain the lengths of all the edges to a given value?
> b) Can I constrain the orientation of edges such that they look like the real
> physical foam ?
> (Think of it as constraining the edges such that they form adjacent
> structural frames each of which look like a sphere)
Note that igraph graphs (and graphs in graph theory in general) do not have any
notion of spatial placement whatsoever. In other words, the nodes of the graph
do not have any actual, associated position in the 2D/3D (or any
higher-dimensional) space. Graphs are just a collection of objects and their
binary relations. In this sense, no, there is no way to constrain the lengths
of the edges because there is no such thing as the "length" of an edge.
Positions, lengths and everything else come into play only when you lay out the
graph, i.e. run an algorithm that assigns positions to the nodes in some space.
igraph has quite a few graph layout algorithms, but they are all designed to
assign positions to an already existing graph in a way that provides a (more or
less) aesthetically pleasing graph drawing, but they do not alter the structure
of the graph at all.
What you need is probably an algorithm that generates both the graph and the
layout at the same time to make it look like the networks you intend to study.
The algorithm should
1) decide how many nodes should there be in the graph (or this could be given
as a parameter)
2) decide where those points should be placed in the 3D space
3) decide which points should be connected with each other
The only algorithm in igraph which bears some resemblance to this scheme is the
geometric random graph generator, which drops N points randomly in the unit
square and then connects those which are closer to each than a prescribed
distance threshold, but I don't think this would suit you as is. However, you
can code your own graph generator algorithm that does something similar:
1) drops some nodes randomly in the unit sphere (this gives you the layout)
2) connects those which are closer to each other than a given threshold (this
gives you the set of edges in the graphs)
This way you could have explicit control over the lengths of the edges because
you would never generate an edge in step 2 that does not satisfy your
requirements.
--
T.