zhengruifeng commented on PR #58302:
URL: https://github.com/apache/spark/pull/58302#issuecomment-5423378311

   ```py
         ____              __
        / __/__  ___ _____/ /__
       _\ \/ _ \/ _ `/ __/  '_/
      /__ / .__/\_,_/_/ /_/\_\   version 5.0.0.dev0
         /_/
   
   Using Python version 3.13.12 (main, Feb 24 2026 16:13:31)
   Client connected to the Spark Connect server at localhost
   SparkSession available as 'spark'.
   
   In [1]: from pyspark.graphframes import GraphFrame
   
   In [2]: v = spark.createDataFrame([
      ...:     ("a", "Alice", 34), ("b", "Bob", 36), ("c", "Charlie", 30), 
("d", "David", 29),
      ...:     ("e", "Esther", 32), ("f", "Fanny", 36), ("g", "Gabby", 60)
      ...: ], ["id", "name", "age"])
      ...: e = spark.createDataFrame([
      ...:     ("a", "b", "friend"), ("b", "c", "follow"), ("c", "b", 
"follow"), ("f", "c", "follow"),
      ...:     ("e", "f", "follow"), ("e", "d", "friend"), ("d", "a", 
"friend"), ("a", "e", "friend")
      ...: ], ["src", "dst", "relationship"])
      ...: g = GraphFrame(v, e)
   
   In [3]: results = g.pageRank(resetProbability=0.15, tol=0.01)
   26/08/26 17:32:50 WARN PageRank: Returned DataFrame is persistent and 
materialized!
   
   In [4]: results.vertices.show()
   
[*********************************************************-----------------------]
 72.40% Complete (0 Tasks running, 0s, Scanned 
8.4[*********************************************************-----------------------]
 72.40% Complete (0 Tasks running, 0s, Scanned 
8.4[*********************************************************-----------------------]
 72.40% Complete (0 Tasks running, 0s, Scanned 
8.4[*********************************************************-----------------------]
 72.40% Complete (0 Tasks running, 0s, Scanned 8.4                              
                                                                                
                      +---+-------+---+-------------------+
   | id|   name|age|           pagerank|
   +---+-------+---+-------------------+
   |  f|  Fanny| 36| 0.3283606792049851|
   |  g|  Gabby| 60| 0.1799821386239711|
   |  a|  Alice| 34|0.44910633706538744|
   |  e| Esther| 32|0.37085233187676075|
   |  d|  David| 29| 0.3283606792049851|
   |  b|    Bob| 36|  2.655507832863289|
   |  c|Charlie| 30| 2.6878300011606218|
   +---+-------+---+-------------------+
   
   
   In [5]: results.edges.show()
   
[************************************************************--------------------]
 75.00% Complete (0 Tasks running, 0s, Scanned 
0.0[************************************************************--------------------]
 75.00% Complete (0 Tasks running, 0s, Scanned 
0.0[************************************************************--------------------]
 75.00% Complete (0 Tasks running, 0s, Scanned 0.0                              
                                                                                
                      +---+---+------------+------+
   |src|dst|relationship|weight|
   +---+---+------------+------+
   |  a|  b|      friend|   0.5|
   |  b|  c|      follow|   1.0|
   |  c|  b|      follow|   1.0|
   |  f|  c|      follow|   1.0|
   |  e|  f|      follow|   0.5|
   |  e|  d|      friend|   0.5|
   |  d|  a|      friend|   1.0|
   |  a|  e|      friend|   0.5|
   +---+---+------------+------+
   
   
   In [6]: spark
   Out[6]: <pyspark.sql.connect.session.SparkSession at 0x7e982c56cc20>
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to