Signed and labeled graphs add information to vertices, edges, or arcs. An ordinary graph records incidence: which vertices are joined. A signed or labeled graph records incidence together with additional data.
A signed graph assigns a sign, usually or , to each edge. A labeled graph assigns labels to vertices, edges, or both. These labels may be numbers, names, symbols, colors, types, strings, or elements of an algebraic structure.
Signed graphs are commonly defined as graphs whose edges carry positive or negative signs. Labeled graphs are finite graphs whose vertices or edges are distinguished by labels, often integers or symbols.
25.1 Motivation
Graphs often need more than adjacency.
In a social network, an edge may represent friendship or hostility. In a road network, an edge may have a route number. In a compiler graph, an edge may have a control-flow condition. In a knowledge graph, an edge may have a relation type such as “owns,” “depends on,” or “located in.”
An unlabeled graph forgets this extra structure. A labeled graph keeps it.
For example, the edge
only says that and are connected. A labeled edge
says what kind of connection it is. A signed edge
says that the relation has negative polarity.
25.2 Signed Graphs
A signed graph is a pair
where
is a graph and
is a sign function.
If
then is a positive edge. If
then is a negative edge.
Some texts write the signs as and instead of and . The numerical notation is convenient because signs can be multiplied.
25.3 First Example
Let
and
Define
Then
is a signed graph.
The triangle on has edge-sign product
Thus this cycle is positive.
25.4 Sign of a Walk or Cycle
The sign of a walk is the product of the signs of its edges.
If
then
A walk is positive if
It is negative if
A walk is positive exactly when it contains an even number of negative edges. It is negative exactly when it contains an odd number of negative edges.
This convention is especially important for cycles. A cycle with an even number of negative edges is positive. A cycle with an odd number of negative edges is negative.
25.5 Balanced Signed Graphs
A signed graph is balanced if every cycle is positive.
Equivalently, every cycle contains an even number of negative edges. Balance is one of the main structural notions in signed graph theory. It was introduced in the modern theory by Frank Harary and is closely connected with social balance theory.
For example, a triangle with three positive edges is balanced. A triangle with two negative edges and one positive edge is also balanced, because the product of signs is positive.
A triangle with one negative edge is unbalanced. A triangle with three negative edges is also unbalanced, because the product of signs is negative.
25.6 Harary’s Balance Theorem
Harary’s balance theorem gives a structural characterization of balanced signed graphs.
A signed graph is balanced if and only if its vertex set can be partitioned into two possibly empty parts
such that every edge inside or inside is positive, and every edge between and is negative.
This theorem gives a simple interpretation. Positive edges occur within groups. Negative edges occur between groups.
In social balance theory, this corresponds to a division into two camps: friends within each camp and enemies across camps.
25.7 Switching
Switching is an operation on a signed graph.
Choose a subset
Reverse the sign of every edge with one endpoint in and the other endpoint in
Keep all other signs unchanged.
Switching changes individual edge signs, but it preserves the sign of every cycle. A cycle enters and leaves the same number of times, so the number of switched edges on the cycle is even.
Therefore balance is invariant under switching.
A signed graph is balanced if and only if it can be switched so that every edge is positive. This is another common form of the balance theorem.
25.8 Frustration
An edge is sometimes called frustrated relative to an assignment of signs to vertices.
Let each vertex receive a state
A positive edge is satisfied if its endpoints have the same state. A negative edge is satisfied if its endpoints have opposite states.
An edge that is not satisfied is frustrated.
The frustration index of a signed graph is the smallest number of edges that must be deleted, or equivalently changed in sign, to make the graph balanced. This quantity measures how far the signed graph is from balance.
Frustration is important in social networks, spin systems, optimization, and clustering.
25.9 Signed Adjacency Matrix
A signed graph has a signed adjacency matrix.
Let
The signed adjacency matrix is defined by
Thus positive edges contribute , negative edges contribute , and nonedges contribute .
For a weighted signed graph, one may combine sign and magnitude:
This matrix is useful in spectral signed graph theory, clustering, and network analysis.
25.10 Labeled Graphs
A labeled graph is a graph whose vertices, edges, or arcs carry labels.
There are several common forms.
| Type | Label function |
|---|---|
| Vertex-labeled graph | |
| Edge-labeled graph | |
| Arc-labeled directed graph | |
| Fully labeled graph | labels on vertices and edges |
The label set may be any set:
a set of strings, a set of colors, a set of relation names, a group, a ring, or a data type.
A signed graph is therefore a special case of an edge-labeled graph where
25.11 Vertex Labels
A vertex-labeled graph has a function
For example, if vertices represent cities, the label may be the city name, population, region, or identifier. If vertices represent tasks, the label may be a task name or duration.
In pure graph enumeration, a labeled graph often means a graph whose vertices are labeled by
This convention distinguishes vertices even when the graph structure has symmetries. For fixed labeled vertices, each possible edge is either present or absent, so the number of simple undirected vertex-labeled graphs is
25.12 Edge Labels
An edge-labeled graph has a function
Edge labels describe the type, value, condition, or meaning of an edge.
Examples include:
| Graph | Edge label |
|---|---|
| Road graph | road name or route number |
| Automaton | input symbol |
| Knowledge graph | relation type |
| Control-flow graph | branch condition |
| Communication graph | protocol |
| Chemical graph | bond type |
| Database graph | foreign-key relation |
In directed graphs, labels are often attached to arcs rather than undirected edges.
For example,
may mean that there is an arc from to labeled by the symbol .
25.13 Labeled Directed Graphs
A labeled directed graph may be written as
where
is a directed graph and
assigns a label to each arc.
Such graphs are used in automata theory. A finite automaton can be represented by a directed graph whose vertices are states and whose arcs are labeled by input symbols.
If
then reading the symbol may move the automaton from state to state .
Labels therefore encode transitions, not only adjacency.
25.14 Group-Labeled Graphs
In a group-labeled graph, labels belong to a group.
Let
be a group. An edge-labeled graph with
is a group-labeled graph.
When the graph is directed, reversing an edge often corresponds to taking the inverse group element. If an arc from to has label , then the reverse direction may be interpreted as having label
Group-labeled graphs generalize signed graphs. A signed graph uses the group
under multiplication.
Group labels are useful when path labels are combined by multiplication or addition, such as gains, voltages, transformations, constraints, or symmetries.
25.15 Path Labels
In an edge-labeled graph, a path may inherit a label from its edges.
If the labels belong to a monoid or group, one can combine labels along a path.
For a directed path
with arc labels
the path label may be defined as
For signed graphs, this becomes the product of edge signs.
For weighted graphs, path weight is often the sum of edge weights instead. Thus the algebra used for labels depends on the problem.
25.16 Isomorphism of Labeled Graphs
Graph isomorphism must respect labels when labels are part of the structure.
Let
and
be edge-labeled graphs. An isomorphism is a bijection
such that
if and only if
and labels are preserved:
For vertex-labeled graphs, one also requires
If labels are not required to be preserved, the problem reduces to isomorphism of the underlying unlabeled graphs.
25.17 Labeled Graphs and Enumeration
Labels affect counting.
For example, suppose the vertex set is fixed as
There are
possible edges in a simple undirected graph. Each edge may be present or absent. Hence there are
simple graphs on this labeled vertex set.
If each present edge may receive one of labels, then each possible pair has choices: absent, or present with one of labels. Therefore the number is
Counting unlabeled graphs is harder because isomorphic copies must be identified.
25.18 Applications
Signed and labeled graphs appear throughout graph theory and computer science.
| Application | Graph structure | Labels or signs |
|---|---|---|
| Social balance | people and relations | friend or enemy |
| Automata | states and transitions | input symbols |
| Knowledge graphs | entities and relations | relation types |
| Road networks | places and roads | route names, speeds, restrictions |
| Program analysis | blocks and jumps | branch conditions |
| Databases | tables and references | relation names |
| Chemistry | atoms and bonds | bond types |
| Linguistics | words or states | grammatical labels |
| Constraint systems | variables | algebraic constraints |
| Electrical networks | nodes and wires | voltage, resistance, sign |
The graph gives the incidence structure. The labels give semantic or algebraic content.
25.19 Common Mistakes
A common mistake is to ignore labels when labels are part of the graph. Two graphs may have the same underlying shape but differ as labeled graphs.
Another mistake is to treat all labels as weights. A label may be a symbol, type, sign, condition, or group element. It may have no numerical order.
A third mistake is to confuse signed graphs with weighted graphs. A signed graph records polarity. A weighted graph records magnitude. A graph may be both signed and weighted.
A fourth mistake is to assume that edge signs are vertex signs. Edge-signed and vertex-signed graphs are different structures.
25.20 Summary
A signed graph is a graph
where
The sign of a walk or cycle is the product of its edge signs. A signed graph is balanced if every cycle is positive. Balanced signed graphs admit a partition into two parts with positive edges inside parts and negative edges between parts.
A labeled graph is a graph equipped with labels on vertices, edges, arcs, or some combination of these. Labels may be names, symbols, numbers, signs, colors, types, or algebraic elements.
Signed and labeled graphs preserve information that ordinary graphs discard. They are essential when edges or vertices carry meaning beyond mere adjacency.