## Archive for the ‘**Directed Graphs**’ Category

## Network Theory and Discrete Calculus – Graph Divergence and Graph Laplacian

This post is part of a series

### Another Note on Notation

In a previous post, I introduced a slightly generalized notation in order to deal with directed graphs with multiple directed edges between any two nodes, e.g. parallel elements in electrical networks. However, the revised notation now makes some simpler calculations look more cumbersome. This is an example of what my adviser called the **conservation of frustration**. For example, the coboundary is now given by:

Applied to a general discrete 0-form, this becomes

To re-simplify the notation while maintaining the advantages of the new generalized notation, we can define

and we’re back to

and

as before. Furthermore, we have

where is the number of directed edges from node to node .

### Trace and Inner Products

Given a discrete 0-form , we define its trace via

Similarly, given a discrete 1-form , its trace is given by

With the trace, we can define the inner product of discrete 0-forms via

and the inner product of discrete 1-forms via

where is the edge product.

### Graph Divergence

The** graph divergence** was introduced here as a boundary operator, but the relation to divergence was mentioned here.

With the inner products defined above, a simple calculation shows

so the graph divergence is the adjoint of the coboundary.

In relating discrete calculus to algebraic topology, typically, in algebraic topology you would have a coboundary operator for cochains and a boundary operator for chains. With discrete calculus, we have both and for discrete forms.

### Graph Laplacian

The **graph Laplacian** of a discrete 0-form is given by

More generally, we could define a **graph Laplace-Beltrami operator**

### Graph Dirac Operator

The **graph Dirac operator** is essentially the “square root” of the graph Laplace-Beltrami operator. Since and , we have

so the/a graph Dirac operator is given by

## Network Theory and Discrete Calculus – Edge Algebra

This post is part of a series

In my last post, I noted that in following John Baez’ series, I’m finding the need to introduce operators that I haven’t previously used in any applications. In this post, I will introduce another. It turns out that we could get away without introducing this concept, but I think it helps motivate some things I will talk about later.

In all previous applications, the important algebra was a noncommutative graded differential algebra. The grading means that the degree of elements add when you multiply them together. For example, the product of two nodes (degree 0) is a node (degree 0+0), the product of a node (degree 0) and a directed edge (degree 1) is a directed edge (degree 0+1), and the product of a directed edge (degree 1) with another directed edge is a directed surface (degree 1+1).

Note the algebra of nodes is a commutative sub-algebra of the full noncommutative graded algebra.

There is another related commutative **edge algebra** with corresponding **edge product**.

The edge product is similar to the product of nodes in that it is a projection given by

It is a projection because for an arbitrary discrete 1-form

we have

and

The product of two discrete 1-forms is

I have not yet come across an application where the full edge algebra is needed. When the product does arise, one of the discrete 1-forms is usual the coboundary of a discrete 0-form, i.e.

When this is the case, the edge product can be expressed as a (graded) commutator in the noncommutative graded algebra, i.e.

An example of this will be seen when we examine electrical circuits.

## Network Theory and Discrete Calculus – Notation Revisited

This post is part of a series

As stated in the Introduction to this series, one of my goals is to follow along with John Baez’ series and reformulate things in the language of discrete calculus. Along the way, I’m coming across operations that I haven’t used in any of my prior applications of discrete calculus to mathematical finance and field theories. For instance, in the The Discrete Master Equation, I introduced a boundary operator

Although, I hope the reason I call this a **boundary operator** is obvious, it would be more precise to call this something like **graph divergence**. To see why, consider the boundary of an arbitrary discrete 1-form

A hint of sloppy notation has already crept in here, but we can see that the boundary of a discrete 1-form at a node is the sum of coefficients flowing into node minus the sum of coefficients flowing out of node . This is what you would expect of a divergence operator, but divergence depends on a metric. This operator does not, hence it is topological in nature. It is tempting to call this a **topological divergence**, but I think graph divergence is a better choice for reasons to be seen later.

One reason the above notation is a bit sloppy is because in the summations, we should really keep track of what directed edges are actually present in the directed graph. Until now, simply setting

if there is no directed edge from node to node was sufficient. Not anymore.

Also, for applications I’ve used discrete calculus so far, there has always only been a single directed edge connecting any two nodes. When applying discrete calculus to electrical circuits, as John has started doing in his series, we obviously would like to consider elements that are in parallel.

I tend to get hung up on notation and have thought about the best way to deal with this. My solution is not perfect and I’m open to suggestions, but what I settled on is to introduce a summation not only over nodes, but also over directed edges connected those nodes. Here it is for an arbitrary discrete 1-form

where is the set of all directed edges from node to node . I’m not 100% enamored, but is handy for performing calculations and doesn’t make me think too much.

For example, with this new notation, the boundary operator is much clearer

As before, this says the graph divergence of at the node is the sum of all coefficients flowing into node minus the sum of all coefficients flowing out of node . Moreover, for any node there can be one or more (or zero) directed edges from into .

## Network Theory and Discrete Calculus – The Discrete Master Equation

This post is a follow up to

**Network Theory and Discrete Calculus – Introduction**

To give the result first, the master equation can be expressed in terms of discrete calculus simply as

where is a discrete 0-form representing the states of a Markov chain (at all times), is a discrete 1-form representing transition probabilities, and is the boundary operator, i.e. a kind of graph divergence.

The rest of this post explains the terms in this discrete master equation and how it works.

### The State-Time Graph

When working with a finite (or countable) number of states, there is nothing new in considering states to be associated to nodes and the transition probabilities to be associated to directed edges of a bi-directed graph. A simple 2-state example is given below

The directed graphs we work with for discrete stochastic calculus are slightly different and could be referred to as “state-time” graphs, which are supposed to make you think of “space-time”. A state at time is considered a different node than the state at time . An example 2-state, 2-time directed graph is illustrated below:

There are four directed edges in this state-time graph, which will be labelled

*

*

*

*

For states, the state-time graph will look similar but with more states appended horizontally.

### The Discrete Master Equation

A discrete 0-form representing the states at all times can be expressed as

and a discrete 1-form representing the transition probabilities can be expressed as

The product of the 0-form and the 1-form is given by

The boundary of a directed edge is given by

Now for some gymnastics, we can compute

This is zero only when the last term in brackets is zero, i.e.

or

Since is right stochastic, we have

so that

In other words, when is right stochastic and , we get the usual master equation from stochastic mechanics

### Parting Thoughts

The master equation is a boundary. This makes me wonder about homology, gauge transformations, sources, etc. For example, since

does this imply

for some discrete 2-form ?

If is a discrete 2-form whose boundary does not vanish, then

gives the same dynamics because This would be a kind of gauge transformation.

There are several directions to take this from here, but that is about all the energy I have for now. More to come…

## Network Theory and Discrete Calculus – Introduction

I’ve enjoyed applying discrete calculus to various problems since Urs Schreiber and I wrote our paper together back in 2004

**Discrete differential geometry on causal graphs**

Shortly after that, I wrote an informal paper applying the theory to finance in

**Financial modeling using discrete stochastic calculus**

From there I wrote up some private notes laying the foundations for applying a higher-dimensional version of discrete calculus to interest rate models. However, life intervened, I went to work on Wall Street followed by various career twists leading me to Hong Kong where I am today. The research has laid fairly dormant since then.

I started picking this up again recently when my friend, John Baez, effectively changed careers and started the Azimuth Project. In particular, I’ve recently developed a discrete Burgers equation with corresponding discrete Cole-Hopf transformation, which is summarized – including numerical simulation results – on the Azimuth Forum here:

**Discrete Burgers equation revisited**

Motivated by these results, I started looking at a reformulation of the Navier-Stokes equation in

**Towards Navier-Stokes from noncommutative geometry**

This is still a work-in-progress, but sorting this out is a necessary step to writing down the discrete Navier-Stokes equation.

Even more recently, John began a series of very interesting Azimuth Blog posts on network theory. I knew that network theory and discrete calculus should link up together naturally, but it took a while to see the connection. It finally clicked one night as I laid in bed half asleep in one of those rare “Eureka!” moments. I wrote up the details in

There is much more to be said about the connection between network theory and discrete calculus. I intend to write a series of subsequent posts in parallel to John’s highlighting how his work with Brendan Fong can be presented in terms of discrete calculus.

## Currency exchange rates, directed graphs, and quivers

I always enjoy working with currency exchange rates because it gives me excuses to draw directed graphs. For example, an exchange rate EURUSD = 1.4 can be thought of as a directed edge from EUR to USD as shown below.

A fact of life when you work in finance is that you rarely have any say in the data available to you for analysis. When working with three currencies, e.g. USD, EUR, and KRW, it would be great if someone handed you a complete FX Matrix with all exchange rates filled in like

Instead, what is usually available is a list of exchange rates such as

With a little patience, you can usually figure out all the cross terms, e.g. it is obvious that from the given data we have

but we’d like to find a systematic way to do this that can be programmed.

So the thing I want to talk about here is starting with a list of exchange rates, i.e. FX Vector, we want to fill in as much of the FX Matrix as possible systematically. It turns out this process is identical to constructing a free category, i.e. quiver, from a directed graph.

In other words, we want to reinterpret the exchange rate as a morphism

Then, “filling in” the FX Matrix means finding all compositions of morphisms, e.g.

How would you do this? Here is what I did…

First, you take the given FX Vector and form an adjacency matrix. In the example above with EUR, USD, and KRW, the adjacency matrix looks like

but in general there will be more zeros.

We can also form an initial FX Matrix

This FX Matrix can be thought of as the currency exchanges that can occur in a single transaction.

An interesting property of the adjacency matrix is that when you raise it to the nth power, the matrix entries represent the number of paths between any two objects in the quiver that require n steps, i.e.

where is the number of paths of length or the number of ways to convert EUR to USD in transactions.

To fill out FX Matrix, we incrementally take powers of and find entries whose value is 1. Since it is getting late and I’m running out of energy, I’ll just write the procedure as a simple pseudo Matlab code:

FXMatrix = Zeros(Size(A)); For n = 1:NumCurrencies FXMatrix(A^n == 1) = FXMatrix1^n(A^n == 1); end

Although the explanation may seem a bit arduous, the final procedure is quite simple and easy to program.

Can you find a better way?

As a side note, this provides an algorithm for generating a quiver from a directed graph, i.e. it gives an adjoint functor to the forgetful functor .