Is there any way to ensure that all edges start from the same place on a node, and end on the same node in graphviz (see my primitive mockup)? I've been looking through the graphviz documentation, and I can't seem to find a parameter to fit this use-case.
You are probably looking for node ports, specifically compass points.
Ports and compass points are defined in the dot language grammar. A detailed description with examples can be found in the dot guide, page 18, "3.1 Node ports":
A node port is a point where edges can attach to a node.
There are two types of ports. Ports based on the 8 compass points "n", "ne", "e", "se", "s", "sw", "w" or "nw" can be specified for any node.
In addition, nodes with a recordshape can use the record structure to define ports, while HTML-like labels with tables can make any cell a port using the PORT attribute of a element.
Two examples of using ports with compass points:
a:e -> b:w
a -> b [tailport=e, headport=w]
See also the headport and tailport attribute description
Related
I am creating a network graph from some data. Not all the data is connected, leading to individual groups (or clusters? I'm not sure of the right terminology).
Below is an example of what it looks like. (I was using 'neato' here).
Is it possible to get graphviz to detect and draw lines around the individual groups?
I have looked at a number of dot examples with subgraphs. However, that would require me to know up-front which nodes belong in the same group, which means I would have to traverse each node to find all the connected nodes so I can include them in respective subgraphs.
I was hoping the framework can somehow do this for me automatically.
I believe that ccomps (http://www.graphviz.org/pdf/ccomps.1.pdf) (a Graphviz program) can identify disconnected subsets and create a subgraph for each subset. The following (Linux) command will identify these subsets and create a cluster around each.
ccomps -x myfile.gv | sed -e '/digraph .*_cc_/s/digraph /subgraph cluster/' -e '1idigraph N {' -e '$a}'
I have a large, but not really huge(?) graph, with 13 subgraph clusters containing about 100 nodes and 3,147 edges.
Dot crashes on Windows and seg faults on Linux.
This question suggests that the solution is to use neato, rather than dot.
But, this page says
Please note there are some quirks here ... only the DOT and FDP layout methods seem to support subgraphs
My output is a huge, black ball of spaghetti, no matter how far I zoom in. So I removed all of the messages but one, and that showed that the subgrphs appear to be drawn nested in each other.
They are absolutely not nested in the source file; here's a sample, with commercially sensitive names changed:
digraph G {
labelloc="t"; // place the label at the top (b seems to be default)
label="XXX message passing";
rankdir = "LR"
newrank = "true"
subgraph cluster_AAA {
label="AAA"
rank="same"
AAA_1
}
subgraph cluster_BBB {
label="BBB"
rank="same"
BBB_1
BBB_2
}
subgraph cluster_CCC {
label="CCC"
rank="same"
CCC_1
CCC_2
CCC_3
}
That certainly seems to be syntactically correct (the edges follow after).
So, it seems like that linked page was correct:
only the DOT and FDP layout methods seem to support subgraphs
BUT, it also seems like I need neato for a large graph.
What are my options?
[Updtae] I ran fdp and got the following error message
Error: node "xxx" is contained in two non-comparable clusters "AAA" and "BBB"
That seems to give a clue. Is it really the case that a node name may not be used in two clusters?
If so, the solution would seem to be to precede the node names with the cluster name ...
so I do not have a general solution to solve your problem.
But have you had a look at "mars"?
It's a command line tool designed specifically for the use of graphviz programs with very large graphs.
You can find it here: https://github.com/marckhoury/mars
How to find nodes IDs in communication range of another node? I set communication range of a node to r=100. I wanted to set all those nodes as one hop neighbors which are in its range. How should i do that in omnet++? Any help will be appreciated.
Module positions are set in OMNeT++ via display string tags. You are looking for the first two components of the p tag, which stores modules' positions in a parent module. From these positions, you can derive the modules' distances. For dynamically finding out which modules are in a parent module, refer to the user manual's chapter on exploring the module hierarchy.
I have a mobility model created by SUMO with area around 2 KM * 2 Km for real map.
I want to compute the results for only part of this model. I read that I can use roiroad or roirect.
Roirect take (x1,y1-x2,y2) as Traci coordination, however, I want to use roiroad to take exactly the cars in specific road.
My question is: if the roiroad function take a string of road name , from where in sumo that I can get this value.
should I construct the map again with Netconvert and using --output-street-names
Edges in SUMO always have an ID. It is stored in the id="..." attribute of the <edge> tag. If you convert a network from some other data format (say, OpenStreetMap) to SUMO's XML representation, you have the option to try and use an ID that closely resembles the road name the edge represents (this is the option you mentioned). The default is to allocate a numeric ID.
Other than by opening the road network XML file in a text editor, you can also find the edge ID by opening the network in the SUMO GUI and right clicking on the edge (or by enabling the rendering of edge IDs in the GUI).
Note that, depending on the application you simulate, you will need to make sure that you have no "gaps" in the Regions Of Interest (ROIs) you specify. When a vehicle is no longer in the ROI its corresponding node is removed from the network simulation. Even if the same vehicle later enters another (or the same) ROI, a brand new node will be created. This is particularly important when specifying edges as ROI (via the roiRoads parameter). Keep in mind that SUMO uses edges not just to represent streets, but also to represent lanes crossing intersections. If you do not specify these internal edges, your ROIs will have small gaps at every intersection.
Note also that up until OMNeT++ 5.0, syntax highlighting of the .ini file in the IDE will (mistakenly) display a string containing a # character as if it were a comment. This is just a problem with the syntax highlighting. The simulation will behave as expected. For example, setting the roiRoads parameter to "-5445204#1 :252726232_7 -5445204#2" in the Veins 4.4 example as follows...
...will result in a Veins simulation where only cars on one of the following three edges are simulated:
on the edge leading to the below intersection; or
on the edge crossing the below intersection; or
on the edge leaving the below intersection.
how to construct tree in ns2 and how to write routing protocol in ns2?
clustered nodes to be arranged in tree structure and code for deflection routing in ns2.
I also need to know how to increase the energy of a node and how to make a node inactive.
For simulating the energy of nodes the example in tcl/ex/wireless-newnode-energy.tcl
Also, to see the available command for changing the energy of a node during simulation, see see source files in mac/wireless-phy.cc, method int WirelessPhy::command(int argc, const char*const* argv)
To implement your own routing protocol in ns2, read this article
I did not fully understand the part about the tree structure and the deflection.