Experimental Graphviz code generation POC built with Jetpack Compose compiler/runtime.

Overview

Compose Dot

Experimental proof of concept to generate GraphViz dot code via Jetpack Compose's tree management. Valid dot file content can be generated simply by provided @Composable functions like SubGraph or Cluster etc.

Project Structure

  • app - Runnable sample
  • dot - Pure Kotlin constructs for representing Dot statements
  • compose-dot - Provides @Composable functions to construct dot statements using Compose Compiler Plugin.

Usage

For example, usage in Kotlin as follows.

DirectedGraph("Hello") {
    node {
        "shape" `=` "rectangle"
    }
    Cluster("Container A") {
        "Item 1" link "Item 2"
    }
    Cluster("Container B") {
        "Item 3" link "Item 4"
    }
    Cluster("Container C") {
        "Item 5" {
            "color" `=` "blue"
        }
        Cluster("Inner Container") {
            "Item 6" {
                "color" `=` "red"
            }
        }
    }
    "Item 1" link "Item 4"
    "Item 2" link "Item 5"
    "Item 6" link "Item 3"
}

Will generate the following .dot source code.

digraph "Hello" {
  node [shape="rectangle"]
  "Item 1" -> "Item 4"
  "Item 2" -> "Item 5"
  "Item 6" -> "Item 3"
  subgraph "cluster_Container A" {
    graph [label="Container A"]
    "Item 1" -> "Item 2"
  }
  subgraph "cluster_Container B" {
    graph [label="Container B"]
    "Item 3" -> "Item 4"
  }
  subgraph "cluster_Container C" {
    graph [label="Container C"]
    "Item 5" [color="blue"]
    subgraph "cluster_Inner Container" {
      graph [label="Inner Container"]
      "Item 6" [color="red"]
    }
  }
}

Visualized via dot command

Further reading

Motivation

License

Copyright 2021 Arunkumar

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You might also like...
A beautiful Undo Redo animation built with Jetpack Compose
A beautiful Undo Redo animation built with Jetpack Compose

A beautiful Undo Redo animation built with Jetpack Compose

This app can be used to track open slots for vaccination. This is built using Jetpack Compose.
This app can be used to track open slots for vaccination. This is built using Jetpack Compose.

Covid Vaccine This projects used the Cowin APIs provided by the government. Screenshots Tech Stack Used Kotlin Dagger Hilt Clean Architecture with Mod

🧱  A tetris game fully built using Jetpack Compose
🧱 A tetris game fully built using Jetpack Compose

A tetris game fully built using Jetpack Compose, almost all UI elements are created by code, including the following app icon, which is also generated by Composable with @Preview.

Add Cloud Firestore to your Android apps built with Jetpack Compose

JetFirestore Add Cloud Firestore to your Android apps built with Jetpack Compose Now with Jetpack Compose you can easily add Cloud Firestore to your e

Telegram ui clone built with Jetpack Compose

Telegram UI clone Make telegram ui with Jetpack Compose. Library Jetpack Compose v1.0.1 Compose Icon v1.0.3 Minimum requirements Android Studio Arctic

Kuberam is built on jetpack compose + Auth0 during Hashnode Hackathon.
Kuberam is built on jetpack compose + Auth0 during Hashnode Hackathon.

Kuberam Kuberam is an app to manage your transactions. Application Install You can Install Kuberam app from Play Store 👇 Insights into the app 🔎 Dar

JetInstagram is an Instagram UI clone app built with Jetpack Compose.
JetInstagram is an Instagram UI clone app built with Jetpack Compose.

JetInstagram JetInstagram is an instagram clone app built with Jetpack Compose. This sample showcases: Home Screen Post Like Button Animation Photo Li

A 7 and 14 segment display for Android built with Jetpack Compose
A 7 and 14 segment display for Android built with Jetpack Compose

SegmentedDisplay A 7-segment and 14-segment display for Android build with Jetpack Compose Customizable Highly customisable. Hook up to a data stream

InstagramJetpackCompose is an Instagram UI clone app built with Jetpack Compose.
InstagramJetpackCompose is an Instagram UI clone app built with Jetpack Compose.

InstagramJetpackCompose is an Instagram UI clone app built with Jetpack Compose.

Glance Experimental Tools aims to supplement Jetpack Glance with features that are commonly required by developers but not yet available.

Glance Experimental Tools ?? Work in-progress: artifacts not available yet This project aims to supplement Jetpack Glance with features that are commo

Google 96 Dec 25, 2022
Highly experimental routing feature for Compose Web

RoutingCompose Highly experimental routing feature for Compose Web Install This package is uploaded to GitHub Packages. repositories { maven {

Philip Wedemann 86 Dec 20, 2022
A CLI utility to convert Jetpack Compose compiler metrics and reports to beautified 😍 HTML page

Compose Compiler Reports to HTML Generator A CLI utility to convert Jetpack Compose compiler metrics and reports to beautified ?? HTML page. Made with

Shreyas Patil 145 Jan 3, 2023
laboratory is the next generation Minecraft server management tool fully written in Kotlin

laboratory laboratory is the next generation Minecraft server management tool fully written in Kotlin Installation Linux: Clone this repository using

mooz 5 Oct 29, 2022
This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Compose.

JetBMICalculator This is a sample app(For beginners - App #2) built using Jetpack Compose. It demonstrates the concept of State Hoisting in Jetpack Co

BHAVNA THACKER 3 Dec 31, 2022
Jetpack-compose-uis - A collection of some UIs using Jetpack Compose. built using Katalog

Jetpack Compose UIs This is a collection of some UIs using Jetpack Compose. It i

Mori Atsushi 3 Dec 15, 2022
📱 WhatsApp clone project demonstrates modern Android development built with Jetpack Compose and Stream Chat SDK for Compose.

This is a WhatsApp clone app built with Jetpack Compose and Stream Chat SDK for Compose. The purpose of this repository is to demonstrate below: Imple

Stream 689 Dec 25, 2022
🔖 A Quotes Application built to Demonstrate the Jetpack Compose UI

?? A Quotes Application built to Demonstrate the Jetpack Compose UI

Sanju S 466 Dec 27, 2022
JetFlix - A clone of Android NetFlix app in Android built using Jetpack compose.

JetFlix A clone of Android NetFlix app in Android built using Jetpack compose. This sample app showcases the following: MVVM Architecture (ViewModel +

Pushpal Roy 40 Dec 6, 2022
A Rick and Morty app built with Jetpack Compose.

RickAndMortyCompose A Rick and Morty app built with Jetpack Compose. ?? Demo ✨ Features Compose UI Kotlin Coroutines Compose Navigation MVVM Architect

Prattham Arora 4 Mar 12, 2022