# Graph Rendering API

**URL:** <https://forum.obsidian.md/t/graph-rendering-api/73378>\
**Category:** Devs: Plugins & API\
**Tags:** graph-view, api, ui-ux\
**Created:** [December 20, 2023, 2:37pm UTC](https://forum.obsidian.md/t/graph-rendering-api/73378 "2023-12-20T14:37:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![madigan](https://forum.obsidian.md/user_avatar/forum.obsidian.md/madigan/32/4559_2.png) [@madigan](https://forum.obsidian.md/u/madigan)\
**Post date:** [December 20, 2023, 2:37pm UTC](https://forum.obsidian.md/t/graph-rendering-api/73378/1 "2023-12-20T14:37:55Z")

</div>

### Use case or problem

I would like to develop a plugin which relabels nodes in the graph to use their alias(es) instead of the file name so that I can use zettlecasten-style names and still have a graph that makes sense (plus, aliases allow me to use symbols which file systems don’t like).

However, there does not appear to be an API to interact with the graph.

### Proposed solution

I imagine that the existing solution has a worker which loads the notes, filters them based on what the user has selected in the “Filters” menu, and then passes them to PIXI for rendering.

I think a relatively simple solution would be to add hooks that the developer could override to add additional filters and transformations. For example:

```javascript

function customTransform(node) { // defaults to a no-op, (i.e. "return node")
  node.title = node.meta.alias || node.title;
}

function customFilter(node) { // defaults to a no-op, (i.e. "return true")
  return true;
}

const nodes = worker.loadData()
                    .filter(byDefaultFilters)
                    .filter(customFilter)
                    .map(customTransform);
view.render(nodes);

```

### Current workaround (optional)

I haven’t been able to find one so far.

### Related feature requests (optional)

This need has been raised a few times in the Developers & API section:

- [Alias in Graph view](https://forum.obsidian.md/t/alias-in-graph-view/10663)
- [Any plans to extend the API to allow for custom graph menus or changing individual nodes?](https://forum.obsidian.md/t/any-plans-to-extend-the-api-to-allow-for-custom-graph-menus-or-changing-individual-nodes/62797)
- [API for writing graph-related plugins](https://forum.obsidian.md/t/api-for-writing-graph-related-plugins/815)

---

<div class="post-metadata">

**Author:** ![joethei](https://forum.obsidian.md/user_avatar/forum.obsidian.md/joethei/32/11969_2.png) [@joethei](https://forum.obsidian.md/u/joethei)\
**Post date:** [December 20, 2023, 2:46pm UTC](https://forum.obsidian.md/t/graph-rendering-api/73378/2 "2023-12-20T14:46:50Z")

</div>

Graph view is a very complicated plugin internally, which is why there is no API currently, and there might never be one.
