Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hierarchies visualization API to lib-ext #220

Merged
merged 1 commit into from
May 5, 2021

Conversation

ileasile
Copy link
Contributor

@ileasile ileasile commented May 3, 2021

API for different hierarchies visualization.
Visualize class types hierarchy and classloaders hierarchy:
image

It is easy to define own wrappers for KMath expressions, KotlinDL network layers, Dataframe hierarchical keys, and so on.
Examples:

class HKClass(node: KClass<*>) : NodeWrapper<KClass<*>>(node) {
    override val ingoingEdges by lazy {
        node.superclasses.map { HKClass(it) }
    }
}

class HClassLoader(node: ClassLoader) : NodeWrapper<ClassLoader>(node) {
    override val ingoingEdges by lazy {
        node.parent?.let { listOf(HClassLoader(it)) } ?: emptyList()
    }
    override val label: String get() {
        return when (node) {
            is URLClassLoader -> node.urLs.joinToString("\\n", "URL ClassLoader:\\n") {
                it.toString()
            }
            else -> node.toString()
        }
    }
}

val node: T
val label: String

val ingoingEdges: List<GraphNode<T>>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe incomingNodes? It will be consistent with the type

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about parentNodes/childNodes/siblingNodes? I think it's incorrect to say "incoming" about graph nodes, but I feel your concern is valid

@ileasile ileasile force-pushed the hierarchy-visualization branch 4 times, most recently from c26dcff to 4de1719 Compare May 5, 2021 18:46
@ileasile ileasile force-pushed the hierarchy-visualization branch from 4de1719 to 77c3f79 Compare May 5, 2021 19:13
@ileasile ileasile merged commit 0dc5720 into master May 5, 2021
@ileasile ileasile deleted the hierarchy-visualization branch May 12, 2021 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants