Order and degree

For any graph, directed or not, we can read off some basic properties that are of interest later in the chapter. We call the number of vertices |V| the order of the graph and the number of edges |E| its degree, sometimes also referred to as its valency. The degree of a vertex is the number of edges that have this vertex as either source or target. In the case of directed graphs and a given vertex v, we can additionally distinguish between in-degree, that is, the sum of all the edges pointing towards v, and out-degree, that is, the sum of all the edges starting at v. To give an example of this, the undirected graph in Figure 1 has order 5 and degree 6, same as the directed graph shown in Figure 2. In the latter, vertex v1 has out-degree 2 and in-degree 1, while v5 has out-degree 0 and in-degree 1.

In the last two examples, we annotated the vertices and edges with their respective identifiers, as specified by the definition G = (V, E). For most graph visualizations that follow, we will assume that the identity of vertices and edges is implicitly known and will instead represent them by labeling our graphs with additional information. The reason we make this explicit distinction between identifiers and labels is that GraphX identifiers can’t be strings, as we will see in the next section. An example of a labeled graph with relationships of a group of people is shown in the following diagram:

 
Figure 3: A directed labelled graph showing a group of people and their relationships
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset