# Graph label propagation with existing labels

**URL:** <https://discourse.julialang.org/t/graph-label-propagation-with-existing-labels/117395>\
**Category:** Graphs\
**Tags:** graphs\
**Created:** [July 23, 2024, 6:06pm UTC](https://discourse.julialang.org/t/graph-label-propagation-with-existing-labels/117395 "2024-07-23T18:06:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ken\_Williams](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ken_williams/32/5289_2.png) [@Ken\_Williams](https://discourse.julialang.org/u/Ken_Williams)\
**Post date:** [July 23, 2024, 6:06pm UTC](https://discourse.julialang.org/t/graph-label-propagation-with-existing-labels/117395/1 "2024-07-23T18:06:04Z")

</div>

I have a `MetaGraph(SimpleGraph(), String, Union{Missing,String})` (see [Home · MetaGraphsNext.jl](https://juliagraphs.org/MetaGraphsNext.jl/stable/)) object where some nodes have a string label and some nodes have the label `missing`. I would like to propagate existing labels to the missing nodes in some natural way. At the beginning, nodes with identical labels are likely to be neighbors and form natural clusters.

I was hoping I could use one of the algorithms in [Community structures · Graphs.jl](https://juliagraphs.org/Graphs.jl/stable/algorithms/community/) like `Graphs.label_propagation()`, but it doesn’t look like the caller can pass initial labels that should be respected and held unchanged throughout the algorithm.

Does anyone have a suggestion for how to achieve this task? I may be missing an application of an existing algorithm in `Graphs.jl`. Thanks.

---

<div class="post-metadata">

**Author:** ![gdalle](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdalle/32/27854_2.png) [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Post date:** [July 24, 2024, 6:36am UTC](https://discourse.julialang.org/t/graph-label-propagation-with-existing-labels/117395/2 "2024-07-24T06:36:33Z")

</div>

I don’t think this variant of the label propagation algorithm exists yet, but it shouldn’t be too hard to code!
