Create nodes and relationship dynamically using pyspark without CQL

I have 2 tables, one is to generate nodes and another is to add a relationship as well properties to the relationship. How can I create nodes and relationships dynamically using pyspark only?