My datas in G.nodes
Node: M0, Attributes: {'type': 'NMOS_transistors', 'vertex_type': 'NMOS', 'device_type': 'transistor', 'nets': ['net3', 'IN1', 'net1', '0'], 'D_terminal': 'net3', 'G_terminal': 'IN1', 'S_terminal': 'net1', 'B_terminal': '0', 'w_value': 6.000000000000001e-07, 'l_value': 2.66e-07}
Node: M5, Attributes: {'type': 'PMOS_transistors', 'vertex_type': 'PMOS', 'device_type': 'transistor', 'nets': ['VOUT', 'net2', 'vdd!', 'vdd!'], 'D_terminal': 'VOUT', 'G_terminal': 'net2', 'S_terminal': 'vdd!', 'B_terminal': 'vdd!', 'w_value': 6.000000000000001e-08, 'l_value': 1.1150000000000001e-06}
Node: IN1, Attributes: {'type': 'terminals', 'vertex_type': 'net', 'device_type': 'net', 'net_type': 'input'}
Node: C0, Attributes: {'type': 'C', 'vertex_type': 'C', 'device_type': 'passive', 'nets': ['net2', 'VOUT'], 'value': 6e-14}
Node: I0, Attributes: {'type': 'dc', 'vertex_type': 'I', 'device_type': 'current_source', 'nets': ['vdd!', 'Vbias'], 'dc_value': 2.9699999999999997e-05}
Node: V1, Attributes: {'type': 'dc', 'vertex_type': 'V', 'device_type': 'voltage_source', 'nets': ['IN2', '0'], 'dc_value': 1.0, 'ac_value': 0, 'frequency': 0}

def get_node_features(G):
    node_features = {}
    for node, data in G.nodes(data=True):
        feature_dict = {}
        device_type = data.get('device_type', None)
        if device_type == 'transistor':
            feature_dict['device_type'] = device_type
            feature_dict['device'] = data.get('vertex_type', None)
            feature_dict['w_value'] = data.get('w_value', None)
            feature_dict['l_value'] = data.get('l_value', None)
            #feature_dict['size'] = data.get('size', None)
            terminals = ['D', 'G', 'S', 'B']
            for terminal in terminals:
                suffix = node[2:]  # Extract the number part from the node name
#                relation = f"{node+'_'+terminal},{data[terminal + '_terminal']}" # 'edge_relation_D': 'NM0_D,net11'
                relation = f"{terminal}{suffix},{data[terminal + '_terminal']}" # 'edge_relation_D': 'D0,net11'
                feature_dict['edge_relation'+'_'+terminal] = relation                
        elif device_type == 'passive':
            feature_dict['device_type'] = device_type
            feature_dict['device'] = data.get('vertex_type', None)
            feature_dict[data.get('vertex_type', None)+'_'+'value'] = data.get('value', None) 
            #feature_dict['size'] = data.get('size', None)
            # Assuming there's only one edge for passive components
            edge = list(G.edges(node))[0]
            relation = f"{edge[0]},{edge[1]}"
            feature_dict['edge_relation'] = relation
        elif device_type == 'current_source':
            feature_dict['device_type'] = device_type
            feature_dict['device'] = data.get('vertex_type', None)
            feature_dict[data.get('vertex_type', None)+'_'+'value'] = data.get('dc_value', None)
            # Assuming there's only one edge for current sources
            edge = list(G.edges(node))[0]
            relation = f"{edge[0]},{edge[1]}"
            feature_dict['edge_relation'] = relation
        elif device_type == 'voltage_source':
            feature_dict['device_type'] = device_type
            feature_dict['device'] = data.get('vertex_type', None)
            feature_dict[data.get('vertex_type', None)+'_'+'value'] = data.get('dc_value', None)
            # Assuming there's only one edge for current sources
            edge = list(G.edges(node))[0]
            relation = f"{edge[0]},{edge[1]}"
            feature_dict['edge_relation'] = relation
        elif device_type == 'net':
            feature_dict['device_type'] = device_type
            feature_dict['net_type'] = data.get('net_type', None)
            # Assuming there's only one edge for net nodes
            edge = list(G.edges(node))[0]
            relation = f"{edge[0]},{edge[1]}"
            feature_dict['edge_relation'] = relation
        
        node_features[node] = feature_dict
    return node_features

# Extract node features
    node_features = get_node_features(G)

after the computation the above code, i am getting the following result,

node_features:
Node: net1, Features: {'device_type': 'net', 'net_type': 'general', 'edge_relation': 'net1,M4'}
Node: M0, Features: {'device_type': 'transistor', 'device': 'NMOS', 'w_value': 6.000000000000001e-07, 'l_value': 2.66e-07, 'edge_relation_D': 'D,net3', 'edge_relation_G': 'G,IN1', 'edge_relation_S': 'S,net1', 'edge_relation_B': 'B,0'}
Node: M3, Features: {'device_type': 'transistor', 'device': 'PMOS', 'w_value': 6.000000000000001e-08, 'l_value': 7.830000000000001e-07, 'edge_relation_D': 'D,net2', 'edge_relation_G': 'G,net3', 'edge_relation_S': 'S,vdd!', 'edge_relation_B': 'B,vdd!'}
Node: C0, Features: {'device_type': 'passive', 'device': 'C', 'C_value': 6e-14, 'edge_relation': 'C0,net2'}
Node: I0, Features: {'device_type': 'current_source', 'device': 'I', 'I_value': 2.9699999999999997e-05, 'edge_relation': 'I0,vdd!'}
Node: V1, Features: {'device_type': 'voltage_source', 'device': 'V', 'V_value': 1.0, 'edge_relation': 'V1,IN2'}

# Convert data to PyTorch tensors
node_features_tensor = torch.FloatTensor(node_features)
adjacency_matrix_tensor = torch.FloatTensor(adjacency_matrix)

# Forward pass
output = model(node_features_tensor, adjacency_matrix_tensor)

For passing the 'node_features_tensor' into the GNN model, i need to modify the existing 'node features' function in the below required format, I need you to give complete new code to extract data from the existing G.nodes for the below requirement.

i need to make the node features as the (device_type, device, component index, values of component). Take data fron G.nodes,
device_type (1) - one hot representation for all the 'device_type': ('transistor', 'passive', 'current_source', 'voltage_source') value is '1', for the device_type ('net') value is '0',
device (7) - one hot representation of 'vertex_type': NMOS, PMOS, C, R, I, V, nets, (NMOS:[1, 0, 0, 0, 0, 0, 0], PMOS:[0, 1, 0, 0, 0, 0, 0],...for others similarly)
component index (13) - one hot representation of 'Node': M0, M1, M2, M3, M4, M5, M6, M7, C0, C1, R0, I0, V1 (if 'vertex_type' is 'nets' then considered it as all zeros), (M0:[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], M1:[0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],.... for others similarly)
value of component (6) - scalar value of 'w_value', 'l_value', 'C_value', 'R_value', 'I_value', 'V_value'. ('w_value', 'l_value' were present in the Node:M0, M1, M2, M3, M4, M5, M6, M7; 'C_value' present in the Node: C0, C1 in the attribute 'value'; 'R_value' present in the Node: R0 in the attribute 'value'; 'I_value' present in the Node: I0 in the attribute 'dc_value'; 'V_value' present in the Node: V1 in the attribute 'dc_value').