Giter Site home page Giter Site logo

Relational graph composition about alga HOT 3 CLOSED

snowleopard avatar snowleopard commented on September 24, 2024
Relational graph composition

from alga.

Comments (3)

snowleopard avatar snowleopard commented on September 24, 2024 1

@anfelor Yes!

In fact, this graph composition will also allow us to implement an instance of Dioid for labelled graphs, much like this is usually done with matrices whose elements are dioids. We will use |*| = compose.

from alga.

anfelor avatar anfelor commented on September 24, 2024

In the labelled graph setting, would the relational composition use the multiplication of our dioid
e. g. (a [ l ]> b) * (b [ k ]> c) = a [ l * k ]> c?

from alga.

snowleopard avatar snowleopard commented on September 24, 2024

#148 provides an implementation of relational composition of algebraic graphs. Note that it is not as good as I hoped for: the size of the resulting expression is O(m1+m2), where m1 and m2 are the number of edges in the given graphs. Note however that the number of edges in the resulting graph may be quadratic, i.e. O(m1*m2), hence the algebraic representation is still very compact.

The implementation is quite short, the main trick is using biclique:

compose :: Ord a => Graph a -> Graph a -> Graph a
compose x y = overlays
    [ biclique xs ys
    | v <- Set.toList (AM.vertexSet mx `Set.union` AM.vertexSet my)
    , let xs = Set.toList (AM.postSet v mx), not (null xs)
    , let ys = Set.toList (AM.postSet v my), not (null ys) ]
  where
    mx = toAdjacencyMap (transpose x)
    my = toAdjacencyMap y

In combination with graph sparsification, this is quite powerful. I will write a blog post to explain how to combine sparsify and compose in an interesting way.

from alga.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.