Git Product home page Git Product logo

kgraph's Introduction

KGraph

KGraph provides an easy to use platform independent graph library. It bundles a convenient DSL to handle the creation of the graph on the go. At the moment, it compiles for:

  • JVM
  • JS
  • Android Native ARM32
  • Android Native ARM64
  • Linux X86_64

Other native builds will come as I figure out how to compile multi-platform.

Goals

  • add search algorithms, blind and heuristic driven
  • add multi-platform tests
  • allow serialization of nodes, edge and whole graph
  • save on file and load from file
  • platform specif graphic visualizations (help reeeaaaally wanted)
  • add Dokka wherever

Usage

KGraph is made by 3 main interfaces: Graph, Node and Edge.

Here an example for creating a graph using the provided DSL:

val g = graphBuilder {

    val n1 = node {
        id = "ciao"
        value = 20
    }

    val n2 = node {
        id = Random.randomString()
        value = HashMap<Int, String>()
    }

    bidirectionEdge {
        initialNode = n1
        arrivalNode = n2
        cost = 20.0
    }

    edge {
        initialNode = n1
        arrivalNode = n1
        cost = 13.123
    }
}

val (result, timeElapsed) = DepthFirstSearch(g, g.nodes.first(), "targetValue").compute()

Installing

Add the JitPack.io repository to the project build.grade:

repositories {
    maven { url 'https://jitpack.io' }
}

Then import the latest version in the build.gradle of the modules you need:

dependencies {
    implementation 'com.github.lamba92:kgraph:{latest_version}'
}

If using Gradle Kotlin DSL:

repositories {
    maven(url = "https://jitpack.io")
}
...
dependencies {
    implementation("com.github.lamba92.kgraph", "kgraph{-platform}", "{latest_version}")
}

The -platform placeholder should be replaced with:

  • -jvm
  • -js
  • -android_native_32
  • -android_native_64
  • -linuxx86_64

Leave it empty for common sources in common library.

kgraph's People

Contributors

lamba92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kgraph's Issues

Build issue

I am getting the following error when building v1.3:

> Failed to transform kgraph-1.3.jar (com.github.lamba92:kgraph:1.3) to match attributes {artifactType=android-dex, dexing-enable-desugaring=true, dexing-incremental-transform=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Could not resolve all transform dependencies for artifact transform dependencies.
         > No variants of com.github.lamba92.kgraph:KGraph-android_native_32:1.3 match the consumer attributes:
             - com.github.lamba92.kgraph:KGraph-android_native_32:1.3:
                 - Incompatible because this component declares attribute 'artifactType' with value 'klib' and the consumer needed attribute 'artifactType' with value 'android-classes-jar'
                 - Other compatible attributes:
                     - Doesn't say anything about dexing-enable-desugaring (required 'true')
                     - Doesn't say anything about dexing-incremental-transform (required 'false')
                     - Doesn't say anything about dexing-is-debuggable (required 'true')
                     - Doesn't say anything about dexing-min-sdk (required '21')
         > No variants of com.github.lamba92.kgraph:KGraph-android_native_64:1.3 match the consumer attributes:
             - com.github.lamba92.kgraph:KGraph-android_native_64:1.3:
                 - Incompatible because this component declares attribute 'artifactType' with value 'klib' and the consumer needed attribute 'artifactType' with value 'android-classes-jar'
                 - Other compatible attributes:
                     - Doesn't say anything about dexing-enable-desugaring (required 'true')
                     - Doesn't say anything about dexing-incremental-transform (required 'false')
                     - Doesn't say anything about dexing-is-debuggable (required 'true')
                     - Doesn't say anything about dexing-min-sdk (required '21')
         > No variants of com.github.lamba92.kgraph:KGraph-linuxx86_64:1.3 match the consumer attributes:
             - com.github.lamba92.kgraph:KGraph-linuxx86_64:1.3:
                 - Incompatible because this component declares attribute 'artifactType' with value 'klib' and the consumer needed attribute 'artifactType' with value 'android-classes-jar'
                 - Other compatible attributes:
                     - Doesn't say anything about dexing-enable-desugaring (required 'true')
                     - Doesn't say anything about dexing-incremental-transform (required 'false')
                     - Doesn't say anything about dexing-is-debuggable (required 'true')
                     - Doesn't say anything about dexing-min-sdk (required '21')

Any help is greatly appreciated.

Find shortest path

Is there a way to find the shortest path instead of the most direct path?

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.