directed graph with conditional vertices

867 Views Asked by At

I'm looking for a graph-based model that is able to describe conditional vertices.

What is the background: I'm trying to describe software methods as a graph. Let's assume a function for a certain domain, which uses the input x1 and x2 to create a certain output y:

f(x1,x2) = y

This is then used to model it as a graph with data items (i.e. in- and outputs) as vertices and function as edges.

The idea of this all is to have several functions and data items (in a registry) as well as a initial problem-description: "I have input a,b,c and I want to get y; how do i need to combine the available functions to get this." I would describe this as a graph and use a shortest-path algorithm then.

My thoughts were to model each function the way described before and add further vertices for combined inputs (i.e. splitting them up into its inseparable components and connect them via a zero-weighted edge):

Image of Graph

However, the model of a directed (acyclic) graph doesn't comply with the fact to have all source-vertices (x1 and x2) of the edges that target to the combined vertex (x1,x2) when traversing through the graph. As it is now, the appearance of x1 would allow to traverse to y, which is wrong.

What do i need? - I would like to know if there is an existing model, that is capable of describing this problem? Maybe I just need the right term for this to search for further information or someone of you knows a complete different approach of reaching this.

EDIT:

To clarify things a bit, here a more complex example:

Let's assume we have the data items (vertices):

V = {a,b,c,d,e,x}

and 4 different functions (f1-f4), which define the edges.

Here is an image of the graph

The elements marked in red should indicate that they have been added for easier processing. Based on this information, the complete graph (marked in blue) could be created.

Now I can use this graph model for further processing. Let's assume the following examples:

a)

Given Input: a,c
Wanted Output: x
Result: empty set (not possible to get to x with just a,c)

b)

Given Input: c,d
Wanted Output: x
Results: R = { (f2,f4,f3,f1) }

c)

Given Input: c,d,a
Wanted Output: x
Results: R = { (f2,f1), (f4,f3,f1) }

The problem here is, that what I used here to intuitively find the paths is not related to basic graph-based algorithms: I need to assume, that a "combined vertex" (e.g. (a,b) needs to be aware of both a and b in order to be used in a path. With a conventional shortest-path algorithm (e.g. Dijkstra) example a) would be possible, as i can easily find a path from c to x but this omits the condition.