blob: fa54e1dbe4564c23fbc73e5b655a5086799c4d8a [file] [log] [blame]
<!DOCTYPE html><html><head><title>R: PowerIterationClustering</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.css">
<script type="text/javascript">
const macros = { "\\R": "\\textsf{R}", "\\code": "\\texttt"};
function processMathHTML() {
var l = document.getElementsByClassName('reqn');
for (let e of l) { katex.render(e.textContent, e, { throwOnError: false, macros }); }
return;
}</script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.15.3/dist/katex.min.js"
onload="processMathHTML();"></script>
<link rel="stylesheet" type="text/css" href="R.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/styles/github.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.3/languages/r.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head><body><div class="container">
<table style="width: 100%;"><tr><td>spark.assignClusters {SparkR}</td><td style="text-align: right;">R Documentation</td></tr></table>
<h2>PowerIterationClustering</h2>
<h3>Description</h3>
<p>A scalable graph clustering algorithm. Users can call <code>spark.assignClusters</code> to
return a cluster assignment for each input vertex.
Run the PIC algorithm and returns a cluster assignment for each input vertex.
</p>
<h3>Usage</h3>
<pre><code class='language-R'>spark.assignClusters(data, ...)
## S4 method for signature 'SparkDataFrame'
spark.assignClusters(
data,
k = 2L,
initMode = c("random", "degree"),
maxIter = 20L,
sourceCol = "src",
destinationCol = "dst",
weightCol = NULL
)
</code></pre>
<h3>Arguments</h3>
<table>
<tr style="vertical-align: top;"><td><code>data</code></td>
<td>
<p>a SparkDataFrame.</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>...</code></td>
<td>
<p>additional argument(s) passed to the method.</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>k</code></td>
<td>
<p>the number of clusters to create.</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>initMode</code></td>
<td>
<p>the initialization algorithm; &quot;random&quot; or &quot;degree&quot;</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>maxIter</code></td>
<td>
<p>the maximum number of iterations.</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>sourceCol</code></td>
<td>
<p>the name of the input column for source vertex IDs.</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>destinationCol</code></td>
<td>
<p>the name of the input column for destination vertex IDs</p>
</td></tr>
<tr style="vertical-align: top;"><td><code>weightCol</code></td>
<td>
<p>weight column name. If this is not set or <code>NULL</code>,
we treat all instance weights as 1.0.</p>
</td></tr>
</table>
<h3>Value</h3>
<p>A dataset that contains columns of vertex id and the corresponding cluster for the id.
The schema of it will be: <code>id: integer</code>, <code>cluster: integer</code>
</p>
<h3>Note</h3>
<p>spark.assignClusters(SparkDataFrame) since 3.0.0
</p>
<h3>Examples</h3>
<pre><code class="r">## Not run:
##D df &lt;- createDataFrame(list(list(0L, 1L, 1.0), list(0L, 2L, 1.0),
##D list(1L, 2L, 1.0), list(3L, 4L, 1.0),
##D list(4L, 0L, 0.1)),
##D schema = c(&quot;src&quot;, &quot;dst&quot;, &quot;weight&quot;))
##D clusters &lt;- spark.assignClusters(df, initMode = &quot;degree&quot;, weightCol = &quot;weight&quot;)
##D showDF(clusters)
## End(Not run)
</code></pre>
<hr /><div style="text-align: center;">[Package <em>SparkR</em> version 3.2.2 <a href="00Index.html">Index</a>]</div>
</div>
</body></html>