1
$\begingroup$

How can I have pair of edges between nodes in this kind of graphs?

cities = CityData[{All, #}] & /@ {"Germany"}; bigcities = 
Select[Select[Join @@ cities, FreeQ[#, ""] &], 
CityData[#, "Population"] > 100000 &];
cityCoords = 
Select[CityData[#, "Coordinates"] & /@ bigcities, FreeQ[#, ""] &];
Needs["ComputationalGeometry`"];
pts = Reverse[cityCoords, 2];
dt = DelaunayTriangulation[pts];
toPairs[{m_, ns_List}] := Map[{m, #} &, ns];
edges = Union[Sort /@ Flatten[toPairs /@ dt, 1]];
Graph[edges, ImagePadding -> 20, 
VertexCoordinates -> pts, VertexStyle -> LightBlue, 
VertexLabels -> bigcities[[All, 1]], 
Prolog -> {LightBrown, EdgeForm[{Thick, Black}], 
CountryData["Germany", "FullPolygon"]}, ImageSize -> 800]
$\endgroup$
3
$\begingroup$

Just use DirectedGraph. At default, that will replace undirected edge to a pair of directed edges.

enter image description here

$\endgroup$
  • $\begingroup$ hamir Thanks.Now I am embarrassed!! $\endgroup$ – Alex Sep 24 '13 at 19:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.