added the tripartitegraph code to it