Ported graph sending logic to functions