1 Introduction

A common theme in the theory of graphs and networks involves extracting and studying a variety of graph parameters that are useful for understanding the graph properties. Over the years, numerous types of graph parameters and measures became the object of attention of graph theorists and network researchers. As a colloquial running example let us pick vertex degrees. Given an n-vertex graph G, we denote its degree sequence by \(\mathcal{DEG}(G) = \langle d_1,\ldots ,d_n\rangle \), where \(d_i\) denotes the degree of vertex i. It is easy to extract the degree sequence from a given graph, and one may use this information in many different ways, depending on the desired application.

An interesting branch of research, on which we focus here, concerns the dual problem where, rather than being given the graph, we are given a sequence of integers \(D=\langle d_1,\ldots ,d_n\rangle \). Thinking of this sequence as a specification for a desired graph, it is natural to ask whether it is possible to find a graph realizing this specification, namely, whose degree sequence conforms to \(D\). Formally, given \(D\), we would like to decide whether there exists a graph G such that \(\mathcal{DEG}(G) = D\). Such a sequence (for which there exists a realization) is sometimes called a graphic sequence. Note that this problem encapsulates (at least) two separate questions. The first concerns the principal existence of a realizing graph, namely it seeks a characterization (or, a necessary and sufficient condition) for a sequence to be graphic. The second question concerns the practical aspect of the problem, namely, the existence of an effective (and hopefully efficient) algorithm for finding such a realizing graph, if exists. Indeed, both problems were studied in the past. Erdös and Gallai gave a necessary and sufficient condition (which also implies an O(n) decision algorithm) for a sequence to be graphic [8]. However, it is unclear how to efficiently construct a graph that has a given graphic sequence using their method. Havel and Hakimi (independently) gave another algorithm for graphic sequences [10, 11], which also implies an efficient O(m) method for constructing a realizing graph for a given graphic sequence, where m is the number of edges in the graph. Their work was later extended in various ways, cf. [19].

In fact, a number of related questions present themselves as well, including the following: (a) Given a degree sequence, find all the (non-isomorphic) graphs that realize it. (b) Given a degree sequence, count all its (non-isomorphic) realizing graphs. (c) Given a degree sequence, sample a random realization as uniformly as possible. (d) Determine the conditions under which a given degree sequence defines a unique realizing graph. (This may be referred to as the graph reconstruction problem.) These realization and reconstruction questions are well-studied in the literature, cf. [5, 8, 10,11,12, 15,16,17,18], and have found several interesting applications, most notably in the study of social networks, cf. [4, 6, 13]. Sampling questions were studied extensively as well, for instance for regular graphs (cf. [20]). In particular, they are used as a component in algorithms for sampling the universe of all graphs with the same degree sequence and estimating its size.

The current paper is motivated by the key observation, made already in [1], that similar questions may be asked for many other types of graph specifications or profiles, based on a variety of other graph parameters and measures, and catering to a host of significant applications. For example, for each vertex i, let \(m_i\) denote the maximum vertex degree in i’s neighborhood. Then \(\mathcal{MAX}(G)=\langle m_1,\ldots ,m_n\rangle \) is the maximum neighborhood degree profile of G. The same realizability questions asked above for degree sequences can be asked for the maximum neighborhood degree profile as well.

This observation paves the road to a rich field of investigation, which to the best of our knowledge has so far been relatively little explored. The only examples that we are aware of for a study of a realization problem (other than for degree sequences) are the results of [1] on the neighborhood list problem and the closely related shotgun assembly problem, where the characteristic \(f_i\) associated with the vertex i is the full description of its neighborhood upto radius r, \(\varGamma _r(i)\). This problem and some related variants were studied in [14]. Our main aim in the current paper is to look at a number of illustrative example profiles and discuss some of the issues that arise, focusing more on questions than on answers, in the hope of promoting this interesting research direction.

2 Specifications and Realizations

2.1 Basic Notions

Assume that each vertex i (\(i=1,\ldots ,n\)) in a graph G is associated with a characteristic \(f_i\). We call the vector \(\mathcal{F}(G)=\langle f_1,\ldots ,f_n\rangle \) the f-profile of G. The profile can be composed of Boolean variables, integers, real numbers, or even pairs or vectors of numbers. In the degree sequence case, \(f_i=d_i\), the degree of vertex i.

We consider situations where we are given an f-specification vector \(F=\langle f_1,\ldots ,f_n\rangle \) of the right form. Note that this vector might not correspond to (i.e., be the f-profile of) any n-vertex graph. We say that a length n f-specification vector \(F\) is a realizable f-profile if there exists an n-vertex graph G whose f-profile satisfies \(\mathcal{F}(G)=F\).

Hereafter, we consider the following problems:

  1. 1.

    Profile realizability: Find a necessary and sufficient condition for an f-specification vector \(F\) to be a realizable f-profile.

  2. 2.

    Profile realization: For a given realizable f-specification \(F\), construct a realizing graph G (namely, one whose f-profile is \(\mathcal{F}(G)=F\)).

  3. 3.

    Approximate realization: For a given non-realizable f-specification \(F\), construct a graph G realizing the largest possible fraction of \(F\) (namely, one whose f-profile \(\mathcal{F}(G)\) matches \(F\) for as many vertices as possible).

Let us return to the \(\mathcal{MAX}\) profile example discussed earlier.

Example 1

Max neighbor degrees: Consider the \(\mathcal{MAX}\)-profile that contains, for every vertex i, the value \(m_i=\max _{j\in \varGamma (i)} d_j\), where \(\varGamma (i)\) denotes the set of neighbors of i. (This could be the “closed” or “open” neighborhood, i.e., including or excluding i itself; for concreteness let us consider closed neighborhoods.) For the realizability problem, it is convenient to represent the input m-specification vector M alternatively in compressed form, as \({\tilde{M}}=\langle n_1,n_2, \ldots , n_k\rangle \), where \(n_i\)’s are non-negative integers with \(\sum _{i=1}^k n_i = n\); here the specification requires that G contains exactly \(n_i\) vertices whose maximum neighbouring degree is i. We may also assume that \(n_k\) is non-zero.

The realizability of a \(\mathcal{MAX}\)-specification was studied in [2], where it was shown that a necessary and sufficient condition for the compressed vector \({\tilde{M}}=\langle n_1,n_2,\ldots ,n_k\rangle \) to be a realizable \(\mathcal{MAX}\)-profile is that \(n_k\ge 1+k\) and \(n_1\) is even.

2.2 Boolean Profiles

When the characteristic \(f_i\) is Boolean, it can be thought of as a vertex property \(P_f\), such that

$$\begin{aligned} f_i = \left\{ \begin{array}{ll} 1, &{} \text{ vertex }\, i\, \text{ has } \text{ property }~P_f, \\ 0, &{} \hbox {otherwise}. \end{array}\right. \end{aligned}$$

In many cases, the profile \(\mathcal{F}(G)\) can be represented more compactly by a pair of numbers \(\langle n,\ell \rangle \), representing the fact that the graph consists of n vertices and \(\ell \) of them satisfy the property \(P_f\).

Example 2

Degree threshold: The degree threshold k profile \(\mathcal{DT}^k\) is defined as follows. For \(0\le k\le n-1\), let

$$\begin{aligned} dt^k_i = \left\{ \begin{array}{ll} 1, &{} d_i \ge k, \\ 0, &{} \hbox {otherwise}. \end{array}\right. \end{aligned}$$

If \(k=0\), then the only realizable \(\mathcal{DT}^0\)-specification is \(\langle n,n\rangle \). If \(k\ge 1\), then every \(\mathcal{DT}^k\)-specification \(\langle n,\ell \rangle \) where \(0\le \ell \le n\) and \(\ell \ne k\) is realizable. To see this, consider two cases. If \(\ell \ge k+1\), then the realizing graph G is a split graph composed of a clique \(K_\ell \) of \(\ell \) vertices and an independent set I of \(n-\ell \) isolated vertices, where there are no edges between \(K_\ell \) and I. Otherwise (\(\ell \le k-1\)), the graph G is a split graph consisting of a clique \(K_\ell \) of \(\ell \) vertices and an independent set I of \(n-\ell \) vertices, where all edges in \(K_\ell \times I\) are contained in the edge set. In this case the degree of each of the \(\ell \) vertices in \(K_\ell \) is \(n-1\ge k\), and the degree of each vertex in I is \(\ell <k\).

In the remaining case where \(\ell =k\), different situations arise. For example, \(\ell =k=1\) yields an unrealizable pair, and so does \(\ell =k=n-1\). For \(2\le \ell =k\le n-2\), a possible realizing graph consists of two vertices u and v and a clique \(K_\ell \) of \(\ell \) vertices such that every vertex of \(K_\ell \) is connected to exactly one of u or v, while the degree of u and v is at least 1. The remaining vertices (if exist) remain isolated. Examples of the constructions are given in Fig. 1.

Fig. 1.
figure 1

\(\mathcal{DT}^k\) realizations of \(\langle 7,4 \rangle \) for \(k < 4\), \(k > 4\), and \(k=4\). In all cases it is a split graph which consists of \(K_4\) and an independent set I with three vertices. In (a), the dotted edges are used only when \(k>4\).

2.3 Notions of Vertex Happiness

In certain contexts in social networks, research has focused on comparisons between peers. For example, people often compare their number of friends with the number of friends of their friends. Consequently, various notions by which a vertex may compare itself with its neighbors were considered in the literature. We may say that a vertex i is happy if its degree satisfies a certain condition compared to its neighbors. Here are two possible definitions of happiness.

Example 3

Low relative loneliness: For any vertex i, the relative loneliness of i is defined as the ratio \(rl_i = \frac{\mathop {\mathrm{avg}}\nolimits _{j\in \varGamma (i)} d_j}{d_i}\), where \(\mathop {\mathrm{avg}}\nolimits \) denotes the average. The relative loneliness profile \(\mathcal{RL}\) can be used to define a Boolean profile of happiness by considering a vertex to be happy if its relative loneliness ratio is small, say, \(rl_i < 1\). Denote the resulting happiness profile by \(\mathcal{H}^{RL}\), where for every i, \(h^{RL}_i=1\) if and only if \(rl_i <1\), or,

$$\begin{aligned} h^{RL}_i = \left\{ \begin{array}{ll} 1, &{} d_i > \mathop {\mathrm{avg}}\nolimits _{j\in \varGamma (i)} d_j, \\ 0, &{} \hbox {otherwise}. \end{array}\right. \end{aligned}$$

Example 4

Not lowest: According to this definition of happiness, the vertex i is happy if \(d_i\) is greater than the degree of some neighbor of i, i.e.,

$$\begin{aligned} h^{NL}_i = \left\{ \begin{array}{ll} 1, &{} d_i > d_j ~\text{ for } \text{ some } \text{ neighbor } j \text{ of } i, \\ 0, &{} \hbox {otherwise}. \end{array}\right. \end{aligned}$$

The resulting (compressed) profile \(\mathcal{H}^{NL}=\langle n,\ell \rangle \) implies that exactly \(\ell \) of the n vertices have a neighbor of a lower degree. It is clear that for \(n=2\), the only realizable \(\mathcal{H}^{NL}\)-specification is \(\langle 2,0\rangle \). So consider \(n\ge 3\). For \(\ell =0\), the specification \(\langle n,0\rangle \) is trivially realizable by a complete graph. It is also easy to verify that the “all-happy” \(\mathcal{H}^{NL}\)-specification where \(\ell =n\) is unrealizable, since the lowest degree vertex in the graph is inevitably unhappy. For \(1\le \ell \le n-2\), one can realize the \(\mathcal{H}^{NL}\)-specification \(\langle n,\ell \rangle \) by a split graph construction similar to that presented earlier for the degree threshold profile. The only remaining case is \(\ell =n-1\). One can verify that the \(\mathcal{H}^{NL}\)-specification \(\langle n,n-1\rangle \) is realizable for every \(n\ge 7\), and direct case analysis reveals that it is unrealizable for \(n=3,4,5,6\).

For the happiness profile based on relative loneliness, \(\mathcal{H}^{RL}\), the well-known friendship paradox states that in most graphs, and in particular in most social networks, the relative loneliness ratio of most vertices is greater than 1 (these are the “sad” vertices, whose friends have more friends on average) [7, 9]. Nevertheless, note that there are graphs for which most of the vertices are happy. In particular, the graph \(K_n - \{1,2\}\), i.e., the complete graph minus one edge, has \(n-2\) happy vertices, and only two slightly sad vertices.

2.4 Approximate Realizations

In certain cases, the given f-specification vector \(F\) is unrealizable, i.e., it is impossible to find a graph G whose profile \(\mathcal{F}(G)\) coincides with \(F\). It may still be of interest to look for a realization that (exactly or approximately) maximizes the number of vertices satisfying the specification requirements.

Formally, given an f-specification vector \(F=\langle f_1,\ldots ,f_n\rangle \) and an n-vertex graph G on the vertices \(i=1,\ldots ,n\) with \(\mathcal{F}\)-profile \(\mathcal{F}(G)\), we define the compatibility of G to \(F\), denoted \(comp(G,F)\), as the number of vertices i such that \(\mathcal{F}(G)_i=f_i\). The graph G realizes \(F\) if \(comp(G,F)=n\). In cases when finding a realizing graph is hard or impossible, a more modest goal may be to find a graph G with as large compatibility \(comp(G,F)\) as possible.

For example, consider the profile of happiness based on the “not lowest” property \(h^{NL}\) defined above, namely, having a neighbor of lower degree. As mentioned earlier, it is impossible to realize the “all-happy” profile when \(\ell =n\). Suppose our goal is to find an optimal realization, namely, one maximizing the number of happy vertices (under this definition). Then we can show that there are graphs with \(n-1\) happy vertices.

3 Three Additional Examples

3.1 The Clique Profile

Let G be a simple (with no parallel edges or self loops) undirected connected graph over the vertex set \(V=\{1,2,\ldots ,n\}\). The clique profile of G, denoted by \(\mathcal{CLIQUE}(G) = \langle k_1,k_2,\ldots ,k_n\rangle \) is defined by setting \(k_i\) to be the size of the largest clique that includes vertex i, for \(1\le i\le n\). Without loss of generality assume that \(k_1\ge k_2 \ge \cdots \ge k_n\).

The clique profile of a triangle free graph without singleton vertices, e.g., trees and bipartite graphs, is \(\langle 2,2,\ldots ,2\rangle \). In a clique profile of a planar graph, \(k_1\le 4\) because a planar graph does not contain a clique of size 5. If a graph can be colored with c colors then \(k_1\le c\) because a clique of size larger than c cannot be colored with c colors. In the clique profile of a graph with maximum degree \(\varDelta \) there is no clique number greater than \(\varDelta +1\).

Observe that the only way to realize \(k_i=1\) is when vertex i is a singleton vertex.

The clique profile admits the following complete characterization:

A k-specification vector \(K=\langle k_1\ge k_2\ge \cdots \ge k_n\rangle \) is a clique profile if and only if \(k_1=k_2=\cdots =k_{k_1}\).

The “only if” part is straightforward since if vertex 1 is a member of a clique of size \(k_1\) then there are at least \(k_1-1\) additional vertices whose clique number is \(k_1\). For the if part, we show a realization with an interval graph.

Associate the open interval \(I_i=(s_i,f_i)=(i-k_i,i)\) of length \(k_i\) with vertex i. The resulting graph G contains an edge (ij) if and only if the intervals \(I_i\) and \(I_j\) overlap. See example in Fig. 2. We need to show that \(\mathcal{CLIQUE}(G)=K\).

By definition, \(f_1< f_2< \cdots < f_n\). Also \(s_1< s_2< \cdots < s_n\) since \(k_1\ge k_2\ge \cdots \ge k_n\). As a result, if the unit open interval \((j,j+1)\) is contained in \(I_i\), then at most \(k_i\) other intervals contain \((j,j+1)\). Consequently, for \(1\le i\le n\), the clique number of vertex i is at most \(k_i\). Finally, observe that the first \(k_1\) intervals intersect at the unit open interval (0, 1) and that for any \(j>k_1\), the \(k_j\) intervals \(I_{j-k_j+1},\ldots ,I_{k_j}\) intersect at the unit interval \((j-k_j,j-k_j+1)\). Therefore, for \(1\le i\le n\), the clique number of vertex i is at least \(k_i\).

Fig. 2.
figure 2

A realization of \(\langle 4,4,4,4,3,2,2,2,1 \rangle \). The dotted line represents the clique of the first \(k_1=4\) intervals.

3.2 The Distance Profile

We next discuss several types of profiles representing distances. Generally, in a distance profile \(\mathcal{DIST}(G)=\langle D_1,\ldots ,D_n\rangle \) of a graph G, the profile \(D_i\) for every \(1\le i\le n\) is itself an n-entry vector, \(D_i=\langle D_{i,1},\ldots ,D_{i,n}\rangle \), where each entry \(D_{i,j}\) is a non-negative integer or \(\infty \), for every \(1\le j\le n\), representing the distance between i and j in G (defined to be infinity when i and j reside in two disconnected components of G). Alternatively, the profile can be thought of as an \(n\times n\) matrix D.

Given a matrix D, we need to decide whether it is a distance profile, namely, if there is an n-vertex unweighted undirected graph \(G=(V,E)\) over \(V=\{1,\ldots ,n\}\) that realizes it, i.e., such that \(dist(i,j,G)=D_{i,j}\) for every \(1\le i,j\le n\). We refer to this problem as the distance realization (DR) problem. We also consider the variant WDR of this question, where the realizing graph G is allowed to be a weighted graph. Two more variants we consider, named DR* and WDR*, permit some of the entries in the matrix D to be left unspecified. That is, we allow entries \(D_{i,j}=*\), in which case dist(ijG) may assume any value.

Note that D must be symmetric, as otherwise no realization is possible. Hence it suffices to look at the upper triangular part of D.

Example: Consider the (unweighted, fully specified) DR problem for \(n=3\) vertices. Consider the following five input matrices.

Then the first four matrices can be realized, respectively, by the empty graph \(G_0\), the graph \(G_1\) consisting of the single edge (1, 3), the path graph \(G_2 = (1,2,3)\), and the complete graph \(G_3\) on \(\{1,2,3\}\) (see Fig. 3). The last distance matrix, \(D_4\), is unrealizable.

Fig. 3.
figure 3

Realizations of \(D_0\), \(D_1\), \(D_2\), and \(D_3\).

Our first observation is that the versions DR and WDR admit a polynomial time algorithm. The following algorithm solves these problem.

  1. 1.

    Initially set \(V\leftarrow \{1,\ldots ,n\}\) and \(E\leftarrow \emptyset \).

  2. 2.

    For each \(1\le i<j\le n\), add an edge (ij) to G of weight \(D_{i,j}\). (In DR version of the problem we add an edge only if \(D_{i,j}=1\).)

  3. 3.

    Calculate the distance matrix of the resulting graph G, and check if it identical to D. If not identical, then return “Impossible”, else return G.

In the partially specified weighted problem WDR*, the same algorithm applies, except that (i) while adding edge to G, all pairs (ij) such that \(D_{i,j}=*\) can be ignored, and (ii) we compare the distance matrix of the resulting graph G with D only at those index-pairs (ij) where \(D_{i,j}\ne *\).

Finally, we claim that the remaining version of the problem, namely, the unweighted partially specified version DR*, is NP-complete. The problem is clearly in NP. One can show that it is complete for NP by a reduction from the coloring problem.

3.3 Realizations by Vertex-Weighted Graphs

A class of more involved realization problems concerns settings where the sought graphs are vertex-weighted. Let us define two example profiles in this setting.

Example 5

Max vertex-weighted neighbor: The maximum vertex-weighted neighbor profile \(\mathcal{MVWN}\), studied in [3], is defined as follows. For a simple undirected weighted graph \((G,{\bar{\omega }})\), where \(G=(V,E)\), and a vector \({\bar{\omega }} = (\omega _1, \ldots , \omega _n)\) of positive integers, \(\mathcal{MVWN}(G,{\bar{\omega }}) = \langle \varphi _1,\ldots ,\varphi _n\rangle \), where \(\varphi _i = \max _{j\in \varGamma (i)} \omega _j\). A \(\varphi \)-specification vector \(\varPhi =\langle \varphi _1,\ldots ,\varphi _n\rangle \) of n positive integers is a \(\varphi \)-profile if there exists a realizing weighted graph \((G,{\bar{\omega }})\) such that \(\mathcal{MVWN}(G,{\bar{\omega }}) = \varPhi \).

The profile realizability problem for maximum vertex-weighted neighbor profiles was given a necessary and sufficient condition for realizability in [3].

Example 6

Vertex-weighted neighborhood sum: The vertex-weighted neighborhood sum profile, the main problem studied in [3], is defined as follows. For a weighted graph \((G,{\bar{\omega }})\) as above, \(\mathcal{VWNS}(G,{\bar{\omega }}) = \langle \varphi _1,\ldots ,\varphi _n\rangle \), where \(\varphi _i = \sum _{j\in \varGamma (i)} \omega _j\). A \(\varphi \)-specification vector \(\varPhi =\langle \varphi _1,\ldots ,\varphi _n\rangle \) of n positive integers is a \(\varphi \)-profile if there exists a realizing weighted graph \((G,{\bar{\omega }})\) such that \(\mathcal{VWNS}(G,{\bar{\omega }}) = \varPhi \).

The profile realizability problem for vertex-weighted neighborhood sum profiles was given necessary and sufficient conditions for even n, as well as for odd \(n\le 5\), but the conditions established for general (odd) n are not tight (although they are almost tight), so the problem is still open.

4 Extensions, Generalizations and Future Work

This paper focused mostly on illustrating possible questions rather than providing answers. Yet clearly, many additional directions for future study present themselves. Let us conclude by mentioning some of these.

  1. 1.

    Questions similar to those discussed in this paper can be raised in other contexts, such as directed graphs, multigraphs, edge-weighted graphs, hypergraphs, and more.

  2. 2.

    Similarly, one may explore such questions where the realizing graph must belong to some special graph class, such as connected graphs, trees and forests, bipartite graphs, planar graphs, and so on.

  3. 3.

    Profiles may be defined on the basis of the graph labels. For example, assuming the graph is labeled, let \(P_f\) be the property that the vertex i has an even number of neighbors whose label is greater than i. This yields the large neighbors parity profile. The specification vector \(F=(1,1,1)\) is a realizable \(P_f\)-profile, as demonstrated by the 3-vertex path graph \((2-1-3)\) (or alternatively, by the 3-vertex graph \(G'\) composed of three singleton vertices). The complementary specification vector \(F'=(0,0,0)\) is not realizable, since there is no 3-vertex graph where all vertices have odd degrees (as implied, e.g., by the known fact that in every graph, the number of odd degree vertices must be even).

  4. 4.

    Interesting profiles arise by combining two simple profiles into a more compound one. For example, one may consider the combined profile \(\mathcal{DEG}\bigwedge \mathcal{H}= \langle (d_1,h_1),\ldots ,(d_n,h_n)\rangle \), obtained from the degree profile \(\mathcal{DEG}=\langle d_1,\ldots ,d_n\rangle \) and some happiness profile \(\mathcal{H}=\langle h_1,\ldots ,h_n\rangle \). The input profile specifies, for every i, both the degree \(d_i\) and a “happiness bit” \(h_i\), and a realizing graph should satisfy both.

  5. 5.

    The question of establishing necessary and sufficient conditions for the existence of unique realizations for various profiles promises to yield interesting challenges for future study.

  6. 6.

    In addition to the profile realizability, profile realization and approximate realization problems discussed so far, one may consider also the following questions:

    • Profile enumeration: How many different realizable f-profiles exist?

    • Optimizing realization: For a given realizable f-specification vector \(F\), and assuming costs on graphs, construct an optimal-cost realizing graph G (namely, one whose f-profile is \(\mathcal{F}(G)=F\) and whose cost is minimum).

  7. 7.

    Several other measures for happiness have been considered in the literature. Some examples are:

    • \(d_i \ge \max _{j\in \varGamma (i)} d_j\) (“largest in the neighborhood”).

    • \(d_i\) is greater than the degrees of half the neighbors (“above the median”).

    • \(d_i\) is greater than the degrees of at least K neighbors.

  8. 8.

    An interesting question concerns distributed solutions for the realizability and realization problems, in a setting where vertices are aware only of their own portion of the profile (e.g., in the congested clique model).